class GuessingGame
{
public static void main(String[] args)
{
//creates a random number between 1 and 999
int randomNumber = 1 + (int)(Math.random() * 1000);
// gives the user 10 guesses
for(int x=0; x<=9; x++)
{
System.out.println("Insert guess between 1 and 999: ");
int guess = Console.readInt();
// if the user guesses correctly "got it!" is printed
if(guess == randomNumber)
{
System.out.println("Got It!");
}
else
//if the guess is too high "too high!" is printed
if(guess > randomNumber)
{
System.out.println("Too High!");
}
else
//if the guess is too low "too low!" is printed
if(guess < randomNumber)
{
System.out.println("Too Low!");
}
}
//tells the user that the game is over and what the correct answer is
System.out.println("Game Over! the correct answer is: " + randomNumber);
}
}