Question: Using Java Guessing Game Have the computer generate a number between 1 and 100, then prompt the user to input a number between 1 and
Guessing Game Have the computer generate a number between 1 and 100, then prompt the user to input a number between 1 and 100. Test that the user's input is an integer and within the range, if it isn't tell them that it is invalid and allow them to continue guessing. Compare the user's number to the computer's number, if the user's number is lower than the computer's, tell them that it is too low. If the number is higher than the computer's, tell them that it is too high. Repeat until the user guesses the number. Keep a record of how many tries it took and display it after the user wins. Do not count any invalid entries. Your output should be similar in appearance to the following. Example Output (user input is in italics): I'm thinking of a number. Guess a value (1-100): 10 Too Low. Guess again: 50 Too High. Guess again: 33 Too High. Guess again: -14 Invalid. Guess again: a Invalid. Guess again: 20 Too High. Guess again: 15 Too Low. Guess again: 17 Correct! You got it in 6 tries
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
