Question: JAVA APPLICATION NEED TO CREATE WITH GIVEN DIRECTIONS Generate a random number between 1 and 110 (inclusive). Prompt the user to enter a guess. Loop

JAVA APPLICATION NEED TO CREATE WITH GIVEN DIRECTIONS

Generate a random number between 1 and 110 (inclusive). Prompt the user to enter a guess. Loop until the user guesses the random number or enters a sentinel value to give up. Print an error message if the user enters a number that is not between 1 and 110. After 3 wrong guesses, the user is given help (higher or lower messages). After 10 wrong guesses, they automatically lose the game. After a game has been completed prompt the user to see if they want to play again. Maximum games that can be played is 256.

**Print the following prior to exiting the program:

number of games played number of games won winning percentage

Required Constants

private static final int MIN_NUMBER = 1;

private static final int MAX_NUMBER = 110;

private static final int EXIT_VALUE = ?1;

private static final int MAX_GAMES = 256;

private static final int MAX_GUESSES = 10;

private static final int HELP_THRESHOLD = 4;

EXAMPLE OUTCOME:

JAVA APPLICATION NEED TO CREATE WITH GIVEN DIRECTIONS Generate a random number

Enter a number between 1 and 110 C-1 to give up): nope.. Enter a number between 1 and 110 (-1 to give up): 1001 is too big... Enter a number between 1 and 110 C-1 to give up): 0 is too small Enter a number between 1 and 110 C-1 to give up): nope. . . Enter a number between 1 and 110 (-1 to give up): nope. . . Enter a number between 1 and 110 C-1 to give up): nope. . . Enter a number between 1 and 110 C-1 to give up): what part of nope don't you understand? Enter a number between 1 and 110 C-1 to give up): nope. . . Enter a number between 1 and 110 C-1 to give up): nope...higher Enter a number between 1 and 110 C-1 to give up): nope..lower Enter a number between 1 and 110 C-1 to give up): GOT IT *it took you 8 guesses Do you want to play again? (y): Enter a number between 1 and 110 (-1 to give up): nope.. Enter a number between 1 and 110 (-1 to give up): QUITTER Do you want to play again? (y): Enter a number between 1 and 110 C-1 to give up): nope. . . Enter a number between 1 and 110 C-1 to give up): GOT IT *it took you 2 guesses Do you want to play again? (y): Thanks for playing the CSC110 guessing game You played 3 games and won 2 of them. Your winning percentage is 66.7%

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!