Assignment: #GuessingGame Due: 04/21/02019 Points: 6

### Specification

Write a program that allows the user to play number guessing games.

##### Playing a Guessing Game

Use `class Random` to 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 (-1) to give up. Print an error message if the user enters a number that is not between 1 and 110. Print an error message if the user enters a wrong guess more than once. Duplicate wrong guesses count as only one wrong guess. After five wrong guesses, the user is given help (higher or lower messages). After a game has been completed prompt the user to see if they want to play again. The user is allowed to play at most four games.

##### Post Game Playing Processing

Print the following prior to exiting the program.

• number of games played
• number of games won
• winning percentage
##### Required Manifest (Named) Constants

Your program must define the following manifest constants prior to the `main()` method and they should be used through your code.

```   static final int MIN_NUMBER = 1;
static final int MAX_NUMBER = 110;
static final int EXIT_VALUE = -1;
static final int MAX_GAMES = 4;
static final int HINT_THRESHOLD = 5;
```
##### Help Generating Random Number

The following statement instantiates a class Random object.

```   Random rng = new Random();
```

The following statement generates a random number in the interval [MIN_NUMBER, MAX_NUMBER].

```   int n = MIN_NUMBER + rng.nextInt(MAX_NUMBER - MIN_NUMBER + 1);
```
##### Example Game

Assume the computer generated random number is 34 for game #1, 73 for game #2, and 99 for game #3.

```*** You are playing the CSC110 Guessing Game ***

Enter a number between 1 and 110 (-1 to give up): 3
nope...
Enter a number between 1 and 110 (-1 to give up): 111
111 is too big...
Enter a number between 1 and 110 (-1 to give up): 21
nope...
Enter a number between 1 and 110 (-1 to give up): 0
0 is too small...
Enter a number between 1 and 110 (-1 to give up): 33
nope...
Enter a number between 1 and 110 (-1 to give up): 50
nope...
Enter a number between 1 and 110 (-1 to give up): 21
what part of nope don't you understand?
Enter a number between 1 and 110 (-1 to give up): 41
nope...
Enter a number between 1 and 110 (-1 to give up): 27
nope...higher
Enter a number between 1 and 110 (-1 to give up): 57
nope...lower
Enter a number between 1 and 110 (-1 to give up): 34
*** GOT IT *** it took you 8 guesses

Do you want to play again? (y/n): y

Enter a number between 1 and 110 (-1 to give up): 99
nope...
Enter a number between 1 and 110 (-1 to give up): -1
*** QUITTER ***

Do you want to play again? (y/n): y

Enter a number between 1 and 110 (-1 to give up): 21
nope...
Enter a number between 1 and 110 (-1 to give up): 99
*** GOT IT *** it took you 2 guesses

Do you want to play again? (y/n): n

Thanks for playing the CSC110 guessing game.

You played 3 games and won 2 of them.