Question: Guess.java The Guess class should provide the method play to actually play the game. Arrange that the method play has no arguments. The game is
Guess.java
The Guess class should provide the method play to actually play the game. Arrange that the method play has no arguments.
The game is that the program is to choose a random number in the range 1 to 1000, and then for the player to attempt to guess that number. At each round, the user enters a guess, and is told whether the number is too high, too low, or correct. If not correct, player may try again, until the player guesses the correct number (you may, if you wish, allow the player to resign by entering a zero). Count the number of guesses.
When the player guesses the correct number, display a message, Congratulations, you guessed the number! Following that show one of the three following messages.
If the number of guesses was fewer than 10, display, Either you know the secret or you were lucky!
If the number of guesses was exactly 10, display, Aha! you know the secret!
Otherwise, display, You should be able to do better!
GuessingGame.java
The GuessingGame class should be a simple class (with a main method) that creates any needed instance of the Guess class, sets it up for one game, and calls the play method of the class. When each game ends, the GuessingGame class should ask whether the player wishes to play another game. It should then either cause another game to be played, or terminate.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
