February 2014
Beginner
1248 pages
62h 25m
English
Lines 59–80 output a report based on the grades entered (as shown in the input/output window in Fig. 5.9). Line 62 determines whether the user entered at least one grade—this helps us avoid dividing by zero. If so, line 65 calculates the average of the grades. Lines 68–77 then output the total of all the grades, the class average and the number of students who received each letter grade. If no grades were entered, line 80 outputs an appropriate message. The output in Fig. 5.9 shows a sample grade report based on 10 grades.
Read now
Unlock full access