Question: Instructioins: Develop a simple class that represents a number guessing game. The game is played by the program randomly generating a number and the user
Instructioins:
Develop a simple class that represents a number guessing game. The game is played by the program randomly generating a number and the user attempting to guess that number. After each guess the program will provide a hint to the user identifying the relationship between the number and the guess. If the guess is above the answer then Too High is returned, if the guess is below the answer then Too Low. Also if the difference between the answer and the guess is less than the difference between the answer and the previous guess, Getting warmer is returned. If the difference between the answer and the guess is more than the difference between the answer and the previous guess, then Getting Colder is returned.




Implementation Notes:
1) The inner loop, (request the next guess) should use the classs isGameOver method to determine if a new guess is needed.
2) Boolean values and predicate method, (methods that return a Boolean) are essential in this project.
3) No loops are required in the classs methods, they are only needed in the Tester.
Submission Requirements:
You should have three files for this assignment:
a) GuessingGame.java - The GuessingGame class,
b) GuessingGame.html - The documentation file generated from your class
c) GuessingGame Tester.java - A driver program for your GuessingGame
class.
GuessingGame MAXGUESSESALLOWED: int answer: int generator : Random gameOver: boolean differential int max: int numGuessesTaken:int GuessingGame0 GuessingGame (int) newGame(int) guess(int) : String isGameOver): boolean 2) The program will allow the user to play multiple games. Once a game is complete the user will be prompted to play a new game or quit. 3) Design and build a GuessingGame class a. One constant i. ii. MAXGUESSESALLOWED an int that represents the maximum number of guesses the user gets, once this value is passed the game is over. (set to 6) b. Seven instance variables. i. answer - an integer representing the randomly generated number. generator- a random Generator object (create from the Java API Random class) (pg 250 in text) gameOver-a Boolean, false if game still in progress, true if the game s over differential - an integer representing the difference between a guess and the answer. max - maximum value of the number to guess. For example, if the maximum number is 100 then the number to guess would be between 0 and 100.(inclusive) numGuessesTaken - an integer that stores the number of guessed taken so far in any game. ii. iii. iv. v. vi
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
