Question: Write a C++ program to prompt user for a file name and read the data containing information for a list of students, store and process

Write a C++ program to prompt user for a file name and read the data containing information for a list of students, store and process the data. For each student, the following data is provided in the file see file format below:

  • Full Name (assume first name is separated from last name with a blank space and there are no middle names)
  • ID (9 digit number)
  • 3 test scores
  • 1 quiz score Your structure must have the above fields and any other field you like to add to make storing and processing data easier.

    Average is calculated using a weighted formula where tests are worth 90% of the grade and quiz is worth 10%. Letter grade assigned based on the following table: Average Grade 90 - 100 --> A 80 - 89.9 --> B 70 - 79.9 --> C 60 - 69.9 --> D 0 - 59.9 --> F Less than 0 --> I Over 100 --> I

Requirements:

  • Assume there are at most 50 students in a given class, but could be less.
  • Develop a struct to represent a students data: (Minimum the following data members need to be included), more is OK.
    • Name (First, Last)
    • ID
    • Scores ( 3 test scores may use an array or simple variables)
    • Quiz (score for 1 quiz)
    • Grade
    • Average
  • Add all the necessary utility functions to help process the struct (read, print, process,)
  • Add a function to verify all entered data is valid (all scores must be integer type between 0-100)
    • Review all test case to make sure that all possibilities related to bad data or bad file are checked and also your error messages must match the require error message exactly.
  • Develop any additional functions to process a list of students as necessary (Such as readList, printList, processList).
  • Required Operations are: (use functions to do these)
    • Print student list information to the monitor and a file (refer to sample output below)
    • Sort the list of students and print it to the monitor:
      • Alphabetical (Based on last name)
    • Search the list of students and print all the details of a student to the monitor (prompt user for the last name of the student, assume all last names are unique)

(You may assume there is no middle name, and first name is terminated with a blank) Requirements:

  • Program must be modular (all tasks must be done in functions)
  • Must include functions to process Student struct or array of Student's structs(Auxiliary/Helper functions)
  • Main should be short and mostly made of call to functions. (no loops)
  • Prompt user for all input and output file names
  • At start of program execution, prompt user for an input file name, start the program with loading the data into the program and then do all the operations one by one pause the program and let the user continue.
  • Global variables are not allowed. All variables must be passed to functions.
  • Your program should calculate the average for the student and assign a letter grade according to the following table. To calculate the average, use the average of test scores and the quiz score. Tests are worth 90% of the total and the quiz is 10%. Verify that all scores are between 0..100, if not set average to -1 and grade to I.
  • Use the following grading scale:
    • If the average is from 90 to 100 the grade is A
    • If the average is from 80 to 89.9 the grade is B
    • If the average is from 70 to 79.9 the grade is C
    • If the average is from 60 to 69.9 the grade is D
    • If the average is from 0 to 59.9 the grade is F
    • If any score is invalid grade is I
  • Use the included data files to test your program. They are included on zyBooks. To pass all the test cases correctly you must call the functions in the following order in the main function:
    • Read File
    • Process List
    • Print to the Monitor
    • Search For a Student
    • Sort List Alphabetically Based on Last Name
    • Print to the Monitor
    • Print List to a File

Data file details <\br> Input data file organization:<\br>

First Last (first is always 1 name but last name could have several part separated by space) ID Test1 Test2 Test3 Quiz (Assume each student has 3 test scores) 

Sample input file: (Assume all names and IDs in the list are unique and must stay unique.)

John Adams 111223333 100 87 93 90 Willy Smith Jr. 222114444 90 73 67 77 Phil Jordan 777886666 100 80 50 -60 

Sample output file format: (Final report)

Name ID Average Grade Adams, John 111-22-3333 91.5 A Smith Jr., Willy 222-11-4444 87.0 B Jordan, Phil 777-88-6666 -1 I 

Student list print format to the monitor:

Name Average Grade Adams, John 91.5 A Smith Jr., Will 87.0 B Jordan, Phil -1 I

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!