I prompted the user to enter inches of rainfall for seven days and stored them in an array. Now, I am trying to display a histogram of this data using a nested loop, but for each inch, I have to display a * like this:
Rainfall Histogram:
****
***
**
******
********
**********
**
the only way I know how to display a number of *s according to user input is by an if statement. I copied and pasted from a similar class assignment I did, so what I have so far is pretty messy and nonsensical:
static char DetermineRainfall(int inches) { System.out.println("Histogram"); //char inches; for(inches = 0; inches < 7; inches++) { for(int j = 0; j < 1; j++) { if (rainamount > .9 && rainamount <= 1) inches = '*'; return inches; } }