Question: s#include #include #include #include using namespace std; char getGradeLetter ( float grade ) { if ( grade > = 9 0 . 0 ) return
s#include
#include
#include
#include
using namespace std;
char getGradeLetterfloat grade
if grade return A;
if grade return B;
if grade return C;
if grade return D;
return F;
int main
ifstream inFilegradestxt;
ofstream outFilestatisticscsv;
if inFile.isopen
cerr "Error opening input file!" endl;
return ;
if outFile.isopen
cerr "Error opening output file!" endl;
return ;
string name;
float grade;
map count ABCDF;
while inFile name grade
char gradeLetter getGradeLettergrade;
countgradeLetter;
Output to terminal
for const char grade : ABCDF
cout countgrade grade endl;
Output to statistics.csv
outFile "Grade,NumStudents
;
for const char grade : ABCDF
outFile grade countgrade
;
inFile.close;
outFile.close;
return ;
HWA Compilation Test
COMPILATION SUCCESSFUL!!
Input File grades.txt
Kelden Amadiro
Daneel Olivaw
Elijah Baley
Giskard Reventlov
Alfred Lanning
Susan Calvin
Han Fastolfe
Gregory Powell
Mike Donovan
Laurance Robertson
Hari Seldon
Dors Venabili
Eto Demerzel
Raych Seldon
Salvor Hardin
Yugo Amaryl
Ebling Mis
John Watson
Sherlock Holmes
Violet Crawley
Greg Lestrade
Missus Hudson
Jim Moriarty
Molly Hooper
Irene Adler
Mycroft Holmes
Tom Branson
John Bates
Mister Carson
HWA Output File 'statistics.csv
PASSED!! Found output File 'statistics.csv
HWA Contents of 'statistics.csv
Grade,NumStudents
A
B
C
D
F
A
B
C
D
F
FAILED!! Contents of 'statistics.csv are incorrect.
Test Failed: False is not true :
HWA Terminal Output IO Formatting
A
B
C
D
F
A
B
C
D
F
FAILED!!
Test Failed: False is not true :
Kelden Amadiro
Daneel Olivaw
Elijah Baley
Giskard Reventlov
Alfred Lanning
Susan Calvin
Han Fastolfe
Gregory Powell
Mike Donovan
Laurance Robertson
Hari Seldon
Dors Venabili
Eto Demerzel
Raych Seldon
Salvor Hardin
Yugo Amaryl
Ebling Mis
Problem A: Making the grade points
The file grades.txt contains a list of names with grades, separated by spaces. Note that the grades may contain decimal values.
John Watson
Sherlock Holmes
Violet Crawley
Write a program that reads in the grades from gradestxt and then outputs the distribution of letter grades to the terminal. Have your program also create an excelfriendly, comma delimited file called statisticscsv that contains the grade distribution. The necessary format for both the terminal output and statistics.csv are shown in the examples below.
Your program should read in the grade for each person, then determine their letter grade using the breakdown shown here. These grade boundaries are inclusive, so an A is anything
Grade A B C D F
Min
Your program should display the distribution of letter grades to the terminal, as shown in the Example Terminal Output below and create a similar excelfriendly file called statistics.csv shown in Example File Output below. Make sure to match the format in the examples below exactly. Notice that the format is different between the terminal output and the csv output, so double check that you are using the correct format for each.
Example Terminal Output
A
B
C
D
F
Example File Output statisticscsv
Grade,NumStudents
A
B
C
D
F
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
