Write a C++ program that reads and processes student file homework.dat . Each re
ID: 3617151 • Letter: W
Question
Write a C++ program that reads and processes student filehomework.dat. Each record (line) of thefile contains a student number (nine digits) followed by five testscores, each valued from 0 to 100, inclusive. One record exists foreach student.
Your program is to read the input file and produce a gradereport written to an output file (you choose its location andname). The report shall display a line for each student, and eachline shall contain the student number, the average score of thefive separate scores, and a letter grade based on the averagescore. The instructor uses the following scale to determine aletter grade.
A 92 andabove
B 84 to 91
C 73 to 83
D 64 to 72
F Below64
Display at the bottom of the report the total number of studentsearning an A grade, the total number of students earning a B grade,and so on for grades C, D, and F.
Use a separate function to determine a student’s lettergrade.
Explanation / Answer
please rate - thanks #include #include using namespace std; char getgrade(double); int main() {int number,g1,g2,g3,g4,g5,a=0,b=0,c=0,d=0,f=0; double average; char grade; ifstream in; ofstream out; in.open("homework.dat"); if(in.fail()) { coutnumber; while(in) { in>>g1>>g2>>g3>>g4>>g5; average=(g1+g2+g3+g4+g5)/5.; grade=getgrade(average); if(grade=='A') a++; else if(grade=='B') b++; else if(grade=='C') c++; else if(grade=='D') d++; else f++; outRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.