Question: Write a program using JAVA and named GuessingGame Using a random numner generator, a while loop and a sentineal value. Guess a number between 1-20.

Write a program using JAVA and named GuessingGame

Using a random numner generator, a while loop and a sentineal value. Guess a number between 1-20.

Write a program that generates a random number and asks the user to guess what the number is. If the users guess is higher than the random number, the program should display That is too high Guess again. If the users guess is lower than the random number, the program should display That is too low Guess again. If the user guesses correctly, Congrats! You nailed it!, is displayed to the user. The program should use a loop that repeats until the user correctly guesses the random number.

Keep track of the number of guesses that the user makes.

Include a sentinel value (of -1), so that the user may exit from the guessing game at any time.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!