Question: Language is C++ Part A - 60% Program Description: Write a program to generate a report based on input received from a text file. Suppose

Language is C++

Part A - 60%

Program Description:

Write a program to generate a report based on input received from a text file. Suppose the input text file student_grades.txt contains the students Last name , First name, SSN, Test1, Test2, Test3, and Test4.

i.e.

Alfalfa Aloysius 123-45-6789 90.0 100.0 83.0 49.0

Generate the output Report File student_final.txt in the following format :

LastName FirstName SSN Test1 Test2 Test3 Test4 FinalLetterGrade

i.e.

Alfalfa Aloysius 123-45-6789 90.0 100.0 83.0 49.0 C+

Last name First name SSN Test1 Test2 Test3 Test4 Final Grade

The program must be written to use the enum letter_grade :

enum letter_grade {A, A_PLUS, A_MINUS, B,B_PLUS, B_MINUS, C, C_PLUS, C_MINUS,D,D_PLUS,D_MINUS,F } ;

Use the following function prototype for deriving letter grade :

letter_grade deriveGrade(double average) ;

The average is calculated as follows : (test1 + test2 + test3 + test4)/4.0

The function deriveGrade should derive the letter_grade of the student based on the following grading scale.

Letter Grade

Percentage

A+

97%+

A

93%-96%

A-

90%-92%

B+

87%-89%

B

83%-86%

B-

80%-82%

C+

77%-79%

C

73%-76%

C-

70%-72%

D+

67%-69%

D

63%-66%

D-

60%-62%

F

0%-59%

Also provide the following function :

string convertToText(letter_grade grade) ; //This function converts a letter_grade type to a string type.

NOTES :

  • Place the namespace in a header file (i.e. grade.h)
  • and place the enum type, convertToText(..) and deriveGrade(..) functions in the namespace stdGrade

This is the Text File provided.

Alfalfa Aloysius 123-45-6789 90.0 100.0 83.0 49.0 Alfred Francis 123-12-1234 97.0 96.0 97.0 48.0 Gerty Gramma 567-89-0123 80.0 60.0 40.0 44.0 Android Alexis 087-65-4321 23.0 36.0 45.0 47.0 Bumpkin Fred 456-78-9012 78.0 88.0 77.0 45.0 Rubble Betty 234-56-7890 90.0 80.0 90.0 46.0 Noshow Cecil 345-67-8901 81.0 65.0 49.0 43.0 Buff Bif 632-79-9939 20.0 30.0 40.0 50.0 Airpump Andrew 223-45-6789 75.0 90.0 100.0 83.0 Backus Jim 143-12-1234 85.0 97.0 96.0 97.0 Carnivore Art 565-89-0123 71.0 80.0 60.0 40.0 Dandy Jim 087-75-4321 92.0 23.0 36.0 45.0 Elephant Ima 456-71-9012 19.0 78.0 88.0 77.0 Franklin Benny 234-56-2890 50.0 90.0 80.0 90.0 George Boy 345-67-3901 40.0 11.0 91.0 84.0 Heffalump Harvey 632-79-9439 30.0 91.0 20.0 30.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!