Question: Write a program to generate a report based on input received from a text file. Suppose the input text file student_status.txt contains the students name
Write a program to generate a report based on input received from a text file. Suppose the input text file student_status.txt contains the students name (lastName, firstName middleName) and average as follows:
| Doe, John K. 93.2 Andrews, Susan S. 84.7 Monroe, Marylin 75.1 Gaston, Arthur C. 62.8 |
Generate the output in the following format :
| Doe, John K. 93.2 A Andrews, Susan S. 84.7 B Monroe, Marylin 75.1 C Gaston, Arthur C. 62.8 D |
The program must be written to use the enum letter_grade :
enum letter_grade {A,B,C,D,F } ;
and define two namespace (tenPoint and sevenPoint) for the function :
letter_grade deriveGrade(double average) ;
The function deriveGrade should derive the letter_grade of the student based on the grading scale.
The first namespace tenPoint should derive the letter grade based on a ten point grading scale.
and the second namespace sevenPoint should derive the letter grade based on a seven point grading scale.
|
| 10 Point | 7 Point |
| A | >= 90 | >= 93 |
| B | >= 80 | >= 85 |
| C | >= 70 | >= 77 |
| D | >= 60 | >= 70 |
| F | < 60 | < 70 |
NOTES :
use ignore() function with ifstream objects whenever you want to ignore the newline character.
For example :
ifstream transferSchoolFile ;
transferSchoolFile.open("student_status.txt", ios::in);
while( !transferSchoolFile.eof())
{
getline(transferSchoolFile, name) ;
transferSchoolFile >> average;
transferSchoolFile.ignore(); //Used here to ignore the newline character.
.
}
You have the option of placing the namespace definitions inside a separate header file (i.e. scale.h).
You can write this as two programs (each with a different namespace) OR a single program where the user is prompted to select the point scale (1. tenPoint or 2. sevenPoint).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
