Code:
import javax.swing.JOptionPane;
public class JUnit3Draft3
/* Work log:
* The third draft is a mixture of draft two and some new coding
* However the JOptionPane won't allow me to enter 10 integers, just one.
* Started paper coding @ 10:15 Am. Ended paper coding @ 4:22 pm
* Began physical coding @ 7:07 PM. Ended physical coding @ 7:44 pm
* Outcome: JOptionPane appears once, but outcome is successful.
* Error message working. Reworked code a large number of ways, but
* JOptionPane stills appears only once. Submitted project for peer review.
* Items to be added: -1 to quit program.
*/
{
public static void main ( String[] args )
{
int num = 0;
int count = 0;
String input;
{
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 [ count ] = num;
System.out.println( "number average:" );
int[] frequency = new int[11];
++frequency[ num / 10 ];
for ( count = 0; count < frequency.length; count++)
{
if (count == 10)
System.out.printf( "%5d: ", 100);
else
System.out.printf( "%02d-%02d: ",
count * 10, count * 10 + 9 );
for ( int stars = 0; stars < frequency[ count ]; stars++ )
System.out.print("*");
System.out.println();
}
}
}
}
I think the answer is simple, but again I am burnt out. Thank you ahead of time.

New Topic/Question
Reply



MultiQuote









|