I need to add a way of counting how many of each input number is between 1-10, 11-20, 21-30, etc. and printing an * in the appropriate row. What do I need to add? Can I use the same array?
import java.io.*;
class Histogram {
//----------------------------------------------------------
// Program to display histogram of range of entered numbers.
//----------------------------------------------------------
publicstaticint limit = 10;
publicstaticint number;
privatestatic BufferedReader stdin;
publicstaticint value = 0;
publicstaticint y;
publicstaticvoid main (String[] args) throws IOException{
String [] list = new String [10];
int [] range = newint [10];
stdin = new BufferedReader (new InputStreamReader(System.in));
System.out.println( "Enter 10 numbers between 1 and 100.");
while (value != limit){ //sentinal to stop entering numbers
for (int index = 1; index <= limit; index ++){
System.out.print ("Enter " + (index) + ": ");
number = Integer.parseInt (stdin.readLine());
value++;
}
System.out.println ("Done.");
System.out.println();
}
// Loop to generate labels of rows
for (int row = 0; row < list.length; row++){
list[row] = (row * 10 + 1) + "- " + (row + 1) * 10;
System.out.println (list[row] + " | ");
}
}//main method
}//class Histogram