Question: Write a program that generates a random number between 1 and 10 and asks the user to guess what the number is. Your program should

Write a program that generates a random number between 1 and 10 and asks the user to guess what the number is. Your program should operate similar to mine, who's output is shown below: ========================================================= $ java Lab5 enter a number between 1 and 10: 5 Your guess of 5 is too low. enter a number between 1 and 10: 7 Your guess of 7 is too high. enter a number between 1 and 10: 6 Your guess of 6 is CORRECT! Your guesses were: 5 7 6 ========================================================= Your program should give the user a maximum of five guesses. After five guesses, the program should display a message and exit as shown below: ========================================================= $ java Lab5 enter a number between 1 and 10: 5 Your guess of 5 is too low. enter a number between 1 and 10: 4 Your guess of 4 is too low. enter a number between 1 and 10: 3 Your guess of 3 is too low. (a particularly unskilled player!) enter a number between 1 and 10: 2 Your guess of 2 is too low. enter a number between 1 and 10: 1 Your guess of 1 is too low. Better luck next time! Your guesses were: 5 4 3 2 1 ========================================================= Note in both sets of output that the program keeps track of the guesses as the user makes them and then displays the guesses at the end of the game. To keep your program as simple as possible at first, wait and add this feature on after you have the basic game functioning. 

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!