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 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 256 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.

```   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;
```
##### Help Generating Random Number

Instantiate a `class Random` objecting using the current time on the computer as a seed.

```   Random rg = new Random(System.currentTimeMillis());
```

Generate a random between MIN_NUMBER and MAX_NUMBER.

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

Assume the computer generated random number is 34 for game #1, 73 for game #2, and 99 for game #3. For example purposes, user inputs are enclosed in brackets <>.

```*** 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): <1001>
1001 is too big...
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>
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.