Write a program that plays a reverse guessing game with the user. The user thinks of a number between 1 and 10, and the computer repeatedly tries to guess it by guessing random numbers. It's fine for...


Write the complete java program.


Write a program that plays a reverse guessing game with the user. The user thinks of<br>a number between 1 and 10, and the computer repeatedly tries to guess it by guessing<br>random numbers. It's fine for the computer to guess the same random number more<br>than once. The user hint to the computer whether the correct number is higher or<br>lower than the computer's guess. The computer should adjust its range of random<br>guesses based on the hint. At the end of the game, the program reports how many<br>guesses were needed. The program will also ask the user to keep on playing or to<br>quit. Your program would produce something like this:<br>This program has you, the user, choose a number between 1 and 10, then I,<br>the computer, will try my best to guess it.<br>Is it 5?<br>(y/n): n<br>Is my answer lower (1) or higher (h) than your number?<br>(1/h): 1<br>Is it 10?<br>(y/n): n<br>Is my answer lower (1) or higher (h) than your number?<br>(1/h): h<br>Is it 9?<br>(y/n) : n<br>Is my answer lower (1) or higher (h) than your number?<br>(1/h): h<br>Is it 7?<br>(y/n) :<br>I got your number of 7<br>Play again?<br>(y/n) : n<br>Bye! See you next time.<br>correct in 4 guesses.<br>

Extracted text: Write a program that plays a reverse guessing game with the user. The user thinks of a number between 1 and 10, and the computer repeatedly tries to guess it by guessing random numbers. It's fine for the computer to guess the same random number more than once. The user hint to the computer whether the correct number is higher or lower than the computer's guess. The computer should adjust its range of random guesses based on the hint. At the end of the game, the program reports how many guesses were needed. The program will also ask the user to keep on playing or to quit. Your program would produce something like this: This program has you, the user, choose a number between 1 and 10, then I, the computer, will try my best to guess it. Is it 5? (y/n): n Is my answer lower (1) or higher (h) than your number? (1/h): 1 Is it 10? (y/n): n Is my answer lower (1) or higher (h) than your number? (1/h): h Is it 9? (y/n) : n Is my answer lower (1) or higher (h) than your number? (1/h): h Is it 7? (y/n) : I got your number of 7 Play again? (y/n) : n Bye! See you next time. correct in 4 guesses.

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here