View Full Version : Hey adam west...remeber when you helped me?
If you do (im running to the store atm, so im putting this here just in case) the text of the problem is..
Create a program called MaxMinofIntegers.java that asks the user to enter any number of positive integers and to enter -999 when finished entering integers. The program should then display the maximum and minimum of the list of integers. The output should include:clear instructions to the user, the list of numbers entered, and the final results. Use a sentinel-controlled whole loop.
Now, i tried doing a simple thing, just too see if it would work, and get an error message (says a ; is missing), haven't figured out how to get the max yet, the -1 was a "clue" from the professor, but i can't figure out what the clue means.
When i remove the minimum, and just try to get the numbers you enter to show, it always says "The integers you entered were -999" so...something wrong there.
This is what i have atm.
import javax.swing.JOptionPane;
public class J4E7
{
public static void main( String[] args )
{
String fnum;
int num1;
int min=9999;
int max= -1;
do {
if (num1<min)
min = num1;
fnum = JOptionPane.showInputDialog( "Enter any number of positive integers (-999 to quit): " );
num1= Integer.parseInt(fnum);
}while ( num1!=-999 );
System.out.println("You entered the integers=" +fnum);
System.out.println("The minimum integer was ="+num1);
System.out.println("The maximum integer was ="+);
}
}
BlairH
02-28-2007, 03:33 AM
Yo man! That codes is whack!
You gonna' need MacGuyver for that shit a'ight?
Fo' shizzle!
Yo man! That codes is whack!
You gonna' need MacGuyver for that shit a'ight?
Fo' shizzle!
If i was MacGuyver, i could do this with a toothpick and a bowling ball.
...
I really wish this was like every other class i've had, where reading the book would let you know how to do it.
vBulletin® v3.6.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.