Question: 1. Use the random method of the java.lang.Math class to generate a random number. 2. The code thats used to validate data should be stored

1. Use the random method of the java.lang.Math class to generate a random number.

2. The code thats used to validate data should be stored in separate methods. For example:

1. Use the random method of the java.lang.Math class to generate a

3. When the user guesses a number, the application should only accept numbers from 1 to 100.

4. If the user enters invalid data, the application should display an appropriate error message and prompt the user again until the user enters valid data.

5. If the users guess is more than 10 higher than the random number, the application should say, Way too high!

6. If the users guess is higher than the random number, the application should say, Too high!

7. If the users guess is lower than the random number, the application should say, Too low!

8.The message thats displayed when the user gets the number should vary depending on the number of guesses. For example:

random number. 2. The code thats used to validate data should be

9. When the user responds to the Play Again prompt, the application should only accept a value of y or n.

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!