Question: the language is Java Write a program named GuessingGameSim that simulates a guessing game where the system randomly generates the answer, and the system (or


Write a program named GuessingGameSim that simulates a guessing game where the system randomly generates the answer, and the system (or "player") randomly generates a guess based on the system's hints e.g. if the player's guess is too high, then the system provides the feedback hint, and the player's next guess is based on that hint. Your program must have the player narrowing in on their guesses, i.e. they will not guess 8 if the system has already told them that 10 is too low, or will not guess 56 if the system has provided feedback that 50 is too high (see the sample output below). The player wins if they guess the answer within 10 tries. Display the total number of guesses made. Sample output 1 (random number generated is 36): Guess a number from 1-100 79 Too high, try again. Guess a number from 1-100 14 Too low, try again. Guess a number from 1-100 36 You win! Number of guesses: 3 Sample output 2 (random number generated is 29): Guess a number from 1-100 52 Too high, try again. Guess a number from 1-100 18 Too low, try again. Guess a number from 1-100 36 Too high, try again. Guess a number from 1-100 22 Too low, try again. Guess a number from 1-100 23 Too low, try again. Guess a number from 1-100 34 Too high, try again. Guess a number from 1-100 27 Too low, try again. Guess a number from 1-100 33 Too high, try again. Guess a number from 1-100 32 Too high, try again. Guess a number from 1-100 31 Too high. 10 strikes, you lose :( Notes: This is a simulation and not a game that a user can play (there will be no user input) Use sample prints of the answer and ranges to help you work on the logic (and remove before submitting!)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
