Good evening, I am having a little trouble with the outcome of my bucket list assignment. Everything seems to be working just fine, but the final outcome isn't up to par. When you enter numbers from 1-30 or 61-99 it goes into its proper place, however numbers enter in the 31-60 range automatically goes into the 61-99 bucketlist. Perhaps the answer is simple, but I have been at this all day and could use a outsiders pov. I will cite the area you helped me in if you want. Here is the code:
import javax.swing.JOptionPane;
public class JavaAssignmentUnit3Draft2
/*
* The second draft focused more on the JOptionPane.
* Within the JOptionPane. The codes used is a mixture of previous codes
* I used in past assignments and new codes.
* Date Started 7/13/10 11:18 P.M. Status: incomplete... ended @ 12:30 A.M.
* Final outcome: JOptionPane appears and can enter 10 integers. However,
* BarChart "*" appears to function normally for lower numbers 0-30.
* Numbers enter to 31-60 automatically goes into 61-99. Considering creating a thrid draft
* Items to be added: -1 to quit program.
*/
{
public static void main ( String[] args )
{
int[] array = new int[11]; //it takes numbers 0 - 99
int num = 0;
int count = 0;
int total = 0;
String input;
for (count = 0; count < 11; count++)
{
input = JOptionPane.showInputDialog( "Enter a number between 0 - 99: ");
num = Integer.parseInt(input);
while (num < 0 || num > 99)
{
JOptionPane.showMessageDialog( null, "Must be between 0 and 99",
"ERROR!", JOptionPane.ERROR_MESSAGE );
num = Integer.parseInt(input);
input = JOptionPane.showInputDialog( "Enter a number between 0 - 99: ");
}
array [ 0 ] = num;
}
System.out.println ( "The amount of times the numbers between 0 - 99 occured. Amount are displayed by *");
String[] star = { "0-30 |", "31-60 |", "61-99 | "};
for ( count = 0; count < 10; count++)
{
num = array [ count ];
if ( num < 5 ) star [0] += "*";
else if ( num < 10 ) star [1] += "*";
else star [2] += "*";
}
for ( count = 0; count < 3; count++ )
System.out.println( star[ count ] );
}
}
Thank you ahead of time.