Question: Write a program that calculates the grades for a course. Your program should prompt the user for the name of a file that stores exam

Write a program that calculates the grades for a course. Your program should prompt the user for the name of a file that stores exam scores. Each line of the file has the following format: LastName:FirstName:Exam1:Exam2:Exam3

The exams are to be weighted 25% for the first exam, 30% for the second exam, and 45% for the third exam. Based on that, a final grade is to be assigned: A if the total is at least 90, B if it is at last 80, C if it is at least 70, D if it is at least 60, and F otherwise. The highest grade based on the total points is always assigned, so a 75 gets a C.

Your program should output to the terminal a list of students with the letter grade, as follows:

LastName FirstName LetterGrade

It should also output to a file, whose name is provided by the user, lines of the form

LastName FirstName Exam1 Exam2 Exam3 TotalPoints LetterGrade

After it is done, it will output the grade distribution. If the input is:

Doe:John:100:100:100

Pantz:Smartee:80:90:80

Then the terminal output is:

Doe John A

Pantz Smartee B

And the output file will contain:

Doe John 100 100 100 100 A

Pantz Smartee 80 90 80 83 B

A 1

B 1

C 0

D 0

F 0

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!