import javax.swing.*;
class guessTheNumber {
/**
*
* @param args
*/
public static void main(String[] args) {
int guesses = 0;
int guess =101;
int random = (int ) (100 * Math.random());
JOptionPane.showMessageDialog( null, "welcome to the guess the number game");
do {
if (guesses == 0){
String inputGuess = JOptionPane.showInputDialog("Please enter your guess (a number between 1 and 100)");
guess = Integer.parseInt(inputGuess);
}else if (guess < random) {
String inputGuess = JOptionPane.showInputDialog("Please guess again (higher)");
guess = Integer.parseInt(inputGuess);
}else{
String inputGuess = JOptionPane.showInputDialog("Please guess again (lower)");
guess = Integer.parseInt(inputGuess);}
guesses++;
} while (guess != random);
JOptionPane.showMessageDialog( null, "you win you took "+guesses+" guesses the number was "+random);
}
}