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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started