Question: JAVA I ) In this assignment, you will be responsible for creating a random number guessing game with a twist. Rather than the computer generating

JAVA

I ) In this assignment, you will be responsible for creating a random number guessing game with a twist. Rather than the computer generating and hiding a number from the player (as is typical), the player will instead choose a number which the computer will attempt to guess. Using prompts that inform the computer whether its guesses are too high or too low (or that it needs to guess higher or lower), your program should intelligently adjust its guessing range to narrow in on a solution. The program should:

(line break, 11 pt)

Generate a random number guess within a valid range (either user specified or hard-coded).

1 ) If hard-coded, the range should be controlled by a variables that can be altered to change the game's range.

2 ) You should use at least two static variables to store the lowest and highest bounds that the computer can guess between.

(line break, 11 pt)

Receive user input regarding how the guessed number relates to the player-held number.

1 ) "H" is customary for "too high"

2 ) "L" is customary for "too low"

3 ) C is customary for correct

4 ) Other inputs may be used at your discretion, but be sure to comment your code appropriately.

(line break, 11 pt)

Use the player response to generate a guess within a better range than its previous guess.

1 ) The guess should be driven by a randomized integer (page 321).

(line break, 11 pt)

End the round when informed that it has reached the correct number.

(line break, 11 pt)

Prompt the user to play again or not and respond appropriately to this input.

1 ) The program should utilize only the first letter of the user response when requesting another game. "Y", "Yes", "Yeah", "Yo", "yorangutan", and similar should all result in a new game, while "N", "Nyet", "Never!", "Not again", "nooooooooo", and similar should result in program termination.

II ) A Sample log of execution is as follow (user inputs are in bold and underlined):

(line break, 11 pt)

Player is thinking of a number between 1 and 100.

Computer guesses: 60

Player responds, this is (high, low, correct): high

Computer guesses: 25

Player responds, this is (high, low, correct): high

Computer guesses: 10

Player responds, this is (high, low, correct): low

Computer guesses: 18

Player responds, this is (high, low, correct): correct

Computer says: Good game, Dave!

Play again? Yes

Player is thinking of a number between 1 and 100.

[]

Play again? Not right now

Thanks for playing!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!