subject
Engineering, 22.09.2020 21:01 khenalilovespandas

Create an application that lets a user guess a number between 1 and 100. Console
Welcome to the Guess the Number Game

I'm thinking of a number from 1 to 100.
Try to guess it.
Enter number: 50
You got it in 1 tries.
Great work! You are a mathematical wizard.
Try again? (y/n): y
I'm thinking of a number from 1 to 100.
Try to guess it.
Enter number: 50
Way too high! Guess again.
Enter number: 30
Too high! Guess again.
Enter number: 15
Too low! Guess again.
Enter number: 23
Too high! Guess again.
Enter number: 19
Too low! Guess again.
Enter number: 21
Too high! Guess again.
Enter number: 20
You got it in 7 tries.
Not too bad! You've got some potential.
Try again? (y/n):
Error! This entry is required. Try again.
Try again? (y/n): x
Error! Entry must be 'y' or 'n'. Try again.
Try again? (y/n): n
Bye - Come back soon!
Specifications
If the user's guess is higher than the random number, the application should display, 'Too high!'
If the user's guess is lower than the random number, the application should display, 'Too low!'
If the user's guess is more than 10 higher or 10 lower than the random number, the application should display, 'Way too high!' or 'Way too low!'
The message that's displayed when the user gets the number should vary depending on the number of guesses.
For example:
Number of guesses Message

<=3 Great work! You are a mathematical wizard.
>3 and <=7 Not too bad! You've got some potential.
>7What took you so long? Maybe you should take
some lessons.
When the user guesses a number, the application should only accept numbers from 1 to 100.
When the user responds to the Try Again? prompt, the application should only accept a value of y or n .nter
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.
The code that's used to validate data should be stored in separate methods.
For example:
public static double getDoubleWithinRange(Scanner sc, String prompt,
double min, double max)
public static int getIntWithinRange(Scanner sc, String prompt,
int min, int max)
The code that's used to run the application should also be stored in separate methods.
Use the random() method of the java. lang. Math class to generate a random number.

ansver
Answers: 1

Another question on Engineering

question
Engineering, 04.07.2019 18:20
The characteristic roots of a dynamic system are: 1.7920 1.8160 i, -1.7920 1.8160 i, -0.4160 what is the order of this system? what are the settling time and damping ratio of the system?
Answers: 3
question
Engineering, 04.07.2019 18:20
Apiston-cylinder device contains 0.1 m3 of liquid water and 0.9 m3 of water vapor in equilibrium at 800 kpa. heat is transferred at constant pressure until the temperature of water reaches 350 °c. determine (a) the quality of water at the initial state (b) the work associated with this process, (c) the heat associated with this process.
Answers: 2
question
Engineering, 04.07.2019 19:10
Apressure vessel with an r/t 20 cannot be treated as thin walled vessel. a)-trune b)- false
Answers: 3
question
Engineering, 04.07.2019 19:10
An engine, weighing 3000 n, is supported on a pedestal mount. it has been observed that the engine induces vibration into the surrounding area through its pedestal at the maximum operating speed. determine the stiffness of the dynamic vibration absorber spring in (n/m) that will reduce the vibration when mounted on the pedestal. the magnitude of the exciting force is 250 n, and the amplitude of motion of the auxiliary mass is to be limited to 2 mm note: in this question type-in right numbers, no decimals, no fractions, no unit. approximate to right number if needed
Answers: 3
You know the right answer?
Create an application that lets a user guess a number between 1 and 100. Console
Welcome to t...
Questions
question
Mathematics, 04.08.2019 05:30
Questions on the website: 13722363