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