... based on all the grades in the two-dimensional array. The rest of the code in each of the two outputBarChart
methods that displays the chart is identical.
Method outputGrades
Method outputGrades
(lines 124–148) uses nested for
statements to output values of the array grades
and each student’s semester average. The output (Fig. 7.19) shows the result, which resembles the tabular format of a professor’s physical grade book. Lines 129–131 of of Fig. 7.18 print the column headings for each test. We use a counter-controlled for
statement here so that we can identify each test with a number. Similarly, the for
statement in lines 136–147 first outputs a row label using a counter variable to identify each student (line 137). Although array indices start ...
Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.