Question: CMPSC 101 LAB 8 Guessing game Write a program that reads a number from the input stream and does not display it. Next, ask the

CMPSC 101 LAB 8 Guessing game Write a program that reads a number from the input stream and does not display it. Next, ask the user to try to guess the number; give up to three guesses. For example:

I am thinking of a number between 1 and 10. Can you guess it within 3 guesses? Enter guess #1: 6 Enter guess #2: 7 Enter guess #3: 8 You lose! The number was 5 Another example: I am thinking of a number between 1 and 10. Can you guess it within 3 guesses? Enter guess #1: 66 Please try again Enter guess #1: 67 Please try again Enter guess #1: 68 Please try again Enter guess #1: 6 Enter guess #2: 7 Enter guess #3: 8 You lose! The number was 5 Run it 6 times with different data, showing at least one run from each of the following situations: 1. Never guesses correctly 2. Guesses correctly on the first guess 3. Guesses correctly on the second guess 4. Guesses correctly on the third guess 5. Hidden value is out of bounds (the program should display a message then end) 6. User-entered value is out of bounds (the program should display a message then allow the user to re-try) Then, following the instructions in the How to package and submit your labs video, package up your work. Double check to confirm that the package is complete (i.e., all the header info, the code, the screen shots, the output, etc.), and then submit it to the drop box. Next, go back and confirm that the submission is in the drop box!

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!