Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem B:Guessing a Random Number The problem here is to guess what number a computer has in mind! You will write a program IN JAVA
Problem B:Guessing a Random Number The problem here is to guess what number a computer has in mind! You will write a program IN JAVA that randomly generates an integer between 0 and 99, inclusive. The program prompts the user to enter a number continuously until the number entered by user matches the random number generated. For cach input, the computer tells whether the input is too low or too high, so that user can make next guess intelligently. Keep track of number of guesses made until the correct answer is given Program should quit with an appropriate message if the user exceeds a specific number of tries (say, for example: 10 tries), when the user keeps giving wrong guesses, perhaps deliberately! Here is a sample run: Computer has generated a magic number between 0 and 99. You have to guess what it 1s in minimum number of tries Enter your Guess: Guess 1 is too high Enter your Guess: Guess 2 is too low Enter your Guess: Guess 3 is too high Enter your Guess: Bingo!! Yes, the correct answer is 39. You guessed it in tries! 50 25 42 39
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started