Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 globalTypes (tenPoint and sevenPoint) for the function :

letter_grade deriveGrade(double average) ;

The function deriveGrade should derive the letter_grade of the student based on their average.

The first namespace globalType tenPoint should derive the letter grade based on a ten point grading scale.

and the second namespace globalType 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

NOTE : 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.

.

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions