Problem:

Write a C++ program that will compute the final average and assign a grade for the students in a class.

Input:

The input file named "class_data.txt" will have the following format:

one line for each student containing the following, separated by at least one space:

student ID
7 programming assignment scores
1 midterm score
1 final exam score

example:

A00123456 92 95 97 88 83 84 70 80 90

Assume the following (you do not need to validate these things):

  • The student ID will not contain any spaces.
  • Each score is an integer.
  • There is no missing data.
  • The data follows the format described above.
  • There will be no more than 50 students (but at least 1).

Output:

Write the output to an output file named "grade_report.txt".

The program should output the student ID, the final average (computed according to the given weights below) formatted to 1 decimal place, and the letter grade (computed according to the grading scale below) for each student.

The grading scale:

Score Grade
90 - 100 A
80 - 89.9 B
70 - 79.9 C
60 - 69.9 D
0 - 59.9 F

The weights for each category:

Programming Assignments*: 25%
Midterm Exam: 30%
Final Exam: 45%
*7 programming assignments,
the lowest score is dropped.

Here is an example of how the output should appear.

StudentID FinalAvg Grade
--------------------------
A00529154 63.8 D
A00656624 87.4 B
A02507691 68.2 D
A00612352 82.4 B
A04012435 77.8 C
A00654400 77.9 C
A00577109 92.8 A
A00580920 86.0 B
A04028610 90.0 A
A04063494 90.0 A
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.