Question: This project requires creating a single-player game, using only the command- line interface. To play the game, the user first chooses an acceptable range of
This project requires creating a single-player game, using only the command- line interface. To play the game, the user first chooses an acceptable range of non-negative integers by entering the minimum and maximum elements in the rage (e.g. if the user enters 1 and 10, the answer will lie in the set {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}). Next, the program must randomly choose one of the numbers in the given range, without telling the user this number. The user then enters a guess, and the program should reply whether that guess is correct, too high, or too low. If the user cannot guess the correct number after 10 attempts, they lose and the program should terminate. In the event of a loss, the program should print what the correct answer was. When the user guesses the correct number, the program should congratulate them and terminate.
At the end of a game, prompt the user to play again, without having to restart the program.
Count the number of guesses that the user took to get the right answer and display it at the end if they win (e.g. You won in only n guesses!)
Allow the user to choose from 3 difficulty levels (Easy, Medium, or Hard) where each different level affects the number of guesses they can make (say, 20, 10, 5, respectively).
IN JAVA
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
