Write a program that reads from a file (with variable number of records) student names and the grades for 2 tests and 3
assignments (the points are between 0 and 100) and determines and outputs for each student the average score for the
2 tests (column Tests Avg)1, average score for the 3 assignments (column Assignments Avg)2, the overall total
points for all tests and assignments (column Points), the numeric grade (column Numeric Grade)3 (between 0 and
100) and the letter grade (column Letter Grade)4. The program should also compute and output the number of
students (row Number), the minimum numeric grade (row Minimum), maximum numeric grade (row Maximum) and
average numeric grade (row Average) among all students and displays them with 2 decimals. Display the output in the
format shown below (use 2 decimals for floating-point numbers and the columns and alignment suggested bellow):
Sample input file: Sample output:
Jerry A 90 70 90 95 80
Mary B 75 90 85 100 90
Abdul C 55 80 80 80 80
Maya D 95 80 100 80 80
Carol E 80 100 90 80 100
Hung F 55 90 75 100 90
Lana G 85 90 100 90 90
Gerald H 35 60 55 60 80
Tyrone I 60 60 50 60 80
Rajiv J 85 75 95 80 80
Gabriela K 90 85 100 90 90
Randy L 95 80 100 85 90
Andrea M 75 80 80 85 80
Irina N 100 95 100 100 90
Juan O 85 90 90 90 80
STUDENT STATISTICS:
Name
Tests
Avg
Assignments
Avg
Points
Numeric
Grade
Letter
Grade
Jerry A 80.00 88.33 425.00 85.00 B
Mary B 82.50 91.67 440.00 88.00 B
Abdul C 67.50 80.00 375.00 75.00 C
Maya D 87.50 86.67 435.00 87.00 B
Carol E 90.00 90.00 450.00 90.00 A
Hung F 72.50 88.33 410.00 82.00 B
Lana G 87.50 93.33 455.00 91.00 A
Gerald H 47.50 65.00 290.00 58.00 F
Tyrone I 60.00 63.33 310.00 62.00 D
Rajiv J 80.00 85.00 415.00 83.00 B
Gabriela K 87.50 93.33 455.00 91.00 A
Randy L 87.50 91.67 450.00 90.00 A
Andrea M 77.50 81.67 400.00 80.00 B
Irina N 97.50 96.67 485.00 97.00 A
Juan O 87.50 86.67 435.00 87.00 B
CLASS STATISTICS:
Number: 15
Minimum: 58.00
Maximum: 97.00
Average: 83.07
Your program should work for any of the files from the assignment (File1.txt, File2.txt, and File3.txt) and any
other files that have the correct format.
while (infile)
{
sum = sum + testscore;//update sum
count++; //increment count
//determine the grade
switch (static_cast<int> (testscore) / 10)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
grade = 'F';
break;
case 6:
grade = 'D';
break;
case 7:
grade = 'C';
break;
case 8:
grade = 'B';
break;
case 9:
case 10:
grade = 'A';
break;