CJCoding With Joseph
15free / daySign inCreate account

Grade Book Report

Write a function void gradeReport(const string& filename). Each line of the file holds a student's name followed by three integer scores, separated by single spaces:

Ann 80 85 90
Bob 70 76 82

For every student, in file order, print the name, a colon, a space and the average of that student's three scores with exactly one digit after the decimal point. After all students, print Class average:  followed by the average of the per-student averages, also with one decimal place. The output for the file above is exactly what is shown in Expected Output.

If the file cannot be opened, or it opens but contains no students, print the single line No data and nothing else. One test passes missing_dir/grades.txt and another passes an empty file.

Do NOT write a main function.

Expected Output:

Ann: 85.0
Bob: 76.0
Class average: 80.5
No data
No data

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Streamsifstream
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.