Guys I am trying to understand why we have incremented frequency and divided grade by 10 could somebody please help explain.
public void getBarChart(){
System.out.println("\nGrade Distribution: ");
int[] frequency = new int[11];
for (int grade : grades)
++frequency[grade / 10];
for (int counter =0 ; counter < frequency.length; counter++){
if(counter == 10){
System.out.printf("%5d: ",100);
}
else{
System.out.printf("%02d-%02d: "
,counter * 10, counter * 10 + 9 );
}
for (int stars= 0; stars < frequency[counter] ; stars++)
System.out.print("*");
System.out.println();
}
}