Question: / * Use Java code to create a guessing game. Randomly generate an integer from 1 - 1 0 . The user gets 3 chances

/* Use Java code to create a guessing game. Randomly generate an integer from 1-10. The user gets 3 chances to guess the correct number. If the users first guess is correct, tell the user they guessed correctly and end the program. If the first guess is incorrect, tell the user if their guess was close (their guess was within 2 of the right answer) or far (their guess was more than 2 away from the right answer), then prompt for another guess. If the users second guess is correct, tell the user they guessed correctly. If the users second guess is incorrect, tell the user they guessed incorrectly and give them the correct answer. int randomNum =(int)(Math.random()*(10-1+1)+1); */

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!