Question: Write a Java class that will play a simple guessing game with the user of your program. Your program begins by describing the rules of
Write a Java class that will play a simple guessing game with the user of your program. Your program begins by describing the rules of the game Then, when playing begins, the program will come up with a number between 0 and 100, and the user will try to guess that number. Each time the user guesses, the program w te the user whether the target number is higher or lower than the guess (but no further information is given). When the user eventually guesses the actual number, the program should let the user know, and also display the number of guesses that the user needed. To simulate a random guess, you should generate a random number using Math.randomO or the Random class. Sample Run: Hello, are you ready to play the hi-lo game?... [include instructions] I am thinking of a number between 0 and 100. Enter a guess: 87 Nope! My number is lower than 87 Enter a guess: 45 No, my number is higher than 45 Enter a guess: 55 Wow! You won in 3 guesses! OPTIONAL: ua a top inlo the prot anytime s n h user in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
