Question: A coding challenge! Finish the code below, and draw a bar chart as displayed, given the following grades array, initialized with values and counter array

A coding challenge! Finish the code below, and draw a bar chart as displayed, given the following grades array, initialized with values and counter array which holds the grade range totals, being primarily, in groups of 10.

00-09:

10-19:

20-29:

30-39:

40-49:

50-59:

60-69: **

70-79: ***

80-89: **

90-99: **

100: *

        int grades[] = { 60, 70, 75, 100, 61, 83, 90, 89, 72, 91 };

        int counter[] = new int [grades.length + 1];

        for ( int i = 0; i < grades.length; ++i) { // loop over entire array

        /* inspect each element and increment the index

            if the grade is in a certain range (ex. 0-9, 10-19…) */

        if (grades[i] == 100) { // account for the odd ball

          counter[10]++;

        else

          counter[(grades[i] % 100) / 10]++;

        }

       // create the code below to show the bar chart per the ranges shown above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To complete the task given we will fill in the code to correctly assess and count the grades falling into the specified ranges and subsequently draw a ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!