im trying to figure out how to get the max and min of the values that are entered if i run this program. I want the user to enter in a series of numbers until they were finished and to terminate it to type -99. I'm having quite a few issues. First i can only get it to go through the while statement if i use -99 as my first number. Once i get through the while statement i dont know how to come up with the min or max of the values. Help please.
import javax.swing.JOptionPane;
public class maxandmin {
/**
* @param args
*/
public static void main(String[] args) {
double number;
String input;
int cap = -99;
input = JOptionPane.showInputDialog("Enter the first number");
number = Integer.parseInt(input);
while(number != cap){
JOptionPane.showInputDialog("Enter the next number");
number = Integer.parseInt(input);
}
JOptionPane.showInputDialog("The smallest of the numbers [INDENT][INDENT][INDENT][/INDENT][/INDENT][/INDENT]entered was : " + // + "/n"
/*+*/ "The largest of the numbers [INDENT][INDENT][INDENT][/INDENT][/INDENT][/INDENT]entered was : ")/* + )*/;
// TODO Auto-generated method stub
}
}