Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Use of the selection construct. 2. Use of the iteration construct. 3. Use of

ID: 642727 • Letter: 1

Question

1. Use of the selection construct.

2. Use of the iteration construct.

3. Use of nested constructs.

4. Use of counters.

5. Calculation of an average.

Your project must meet all specific and general requirements.

Specific Requirements:

Write an application program that will allow the user to interactively play the Hi-Lo guessing game.

It will be easier to write a simple version of the program where the user only plays one game as outlined by Increment 1 below. After you have this version working, then revise your program so that multile games can be played in addition to the other requirements as outlined by Increment 2.

To start, the program will print a greeting with the instructions for playing the game.

Increment 1 - Play the game once:
The program will:

print instructions for the game.

generate a random number between 1 and 10 (inclusively).

prompt & read the user's guess.

selectively print an appropriate message of "That's too high!", "That's too low!" or "You guessed correctly!"

Increment 2 - Allow the user to play multiple games:
The program will:

After a game has been played, ask the user if they want to play again.

Print the following statistics when the user quits.

How many times the game was played.

How many times the user won.

How many times the computer won.

The player's average.

Whether or not the player is a superstar, where superstar status is given for an average of 90% or above.

Use meaningful labels for all outputs.

Programming tip: During the development of your program, echo print the random number that the user is supposed to guess so that you can test your program appropriately.

Bonus of 5 points:Allow multiple guesses in the game:
The program will:

Allow the user to guess the number a maximum of three times before counting it wrong.

Sample Output:

Hello! Let's play the Hi-Lo Guessing Game!

First, here are the rules...

I will think of a number from 1 to 10 and then ask you to guess the number. If you guess the number correctly, then I will print a congratulatory message and count the game as a win to you! However, if you guess incorrectly, then I will print either "High" or "Low" according to whether or not your guess was - you guessed it - too high or too low.

You will have three tries to guess the number before it counts as a loss.

At the end of the game, I will ask you if you want to play again.

You can play the game as many times as you like.

Once you indicate that you do not want to play again, I will print the number of games that you have played, the number of times you won the game, and the number of times that you lost the game.

Okay, let's get started!!

I am thinking of a number from 1 to 10...

What do you think it is? 3

Sorry, too low. Please guess again : 7
Sorry, too high. Last try! Guess again: 5

Sorry, the number was 4. That counts as a loss!

Do you want to play again? (yes/no) : yes

Okay, Starting Game 2!

I am thinking of a number from 1 to 10...

What do you think it is? 5

Sorry, too high. Please guess again: 3

You guessed correctly! Congratulations, that counts as a win!

Do you want to play again? (yes/no) : no

You won 1 game and lost 1 game out of 2 games played.

This means you won 50% of your games this time.

Sorry, but this does not make you a superstar. To be a SuperStar you have to win at least 90% of your games!

See you later!

Explanation / Answer

DetermineWinner.java

GameEngine.java

OneDice.java

TwoDice.java

ThreeDice.java