Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My apologies for not specifying this: I would like this to be coded in C++. Thank you! Problem B) (20 Points) Program to compute, sort,

My apologies for not specifying this: I would like this to be coded in C++.

Thank you!

image text in transcribed

Problem B) (20 Points) Program to compute, sort, and display student grades for a course Information processing such as computing averages, sorting data and displaying the results is something that is used ubiquitously. Assume the course records for a particular course are in a file named: "Grades.txt" (this file will always serve as the input file for your program). The input file is in exactly the following format. Each line contains a student's x.500id, then one space, then five quiz scores. The quiz numbers can be real numbers (numbers that contain fractional components) and are each separated by one space For example, three entries in the file "Grades.txt" might contain the following data: liux0006 90 80 90 100 85 olson038 95 95 90 93 85 kumar010 90 85 85 95 92 For each student, your program should read in the data on each student from the file Grades.txt", and compute their final average using their five quiz scores, and store it with each student's quiz scores. Note that a two- dimensional array, or parallel arrays might be useful in this regard. For example, after computing the averages for the three students above, your program will store (in memory, no need to write back to file) the following data for each of them: liux0006 90 80 90 100 85 89 olson038 95 95 90 93 85 91.6 kumar010 90 85 85 95 92 89.4 01 son038 has a Final Average of 91. 6, and kumar@10 has a (So liux0006 has a Final Average of 89. final average of 89.4) After doing this, your program should enter a continuation loop that: Prompts the user if they would like to sort the results by X.500 id or final grade, and 2. 1. obtains the user's response; 3. sorts the data according to the user's response; 4. displays the results to the console; 5. ask the user if they would like to continue A possible example of a run of your program is as follows Would you like to sort the results by x.500id or final grade (enter x or g)?: x 90 85 85 95 92 90 80 90 100 85 89.4 89 olson038 Would you like to continue (enter y or Y): y Would you like to sort the results by x.500id or final grade (enter x or g)?: h Error: please enter x for x.500id or g for final grade Would you like to sort the results by x.500id or final grade (enter x or g)?:g 95 95 90 93 85 91.6 95 95 90 93 85 90 85 85 95 92 90 80 90 100 85 91.6 89.4 89 Would you like to continue (enter y or Y): n Constraints: You should only open and close the input file stream pointing to the file "Grades.txt" once in your program, Thus you should use arrays and/or multidimensional arrays to store and process the data in your program. 1. 2. The maximum number of students you will have to account for is 50 Note, your program should function correctly on any data set that conforms to the specifications documented above, so you should be sure to test your on more than one data set. 3. 4. The program will always obtain its input from the file named Grades.txt Write, test, and correct your program. Have all the functions, including main, in a single file with the function definitions after main

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions