Question: Please keep it simple and at a beginner's level Try to only use the main topics to make the program function Main topics: User validated

Please keep it simple and at a beginner's level

Try to only use the main topics to make the program function

Main topics:

User validated input

if & if - else Statements

Loop Statements

Program Specification:

Write a program that allows a single Player (the user) to play a simple three dice game of chance against The Odds.

Game Description:

There is a single player, with four (four sided) dice

The sides of each die are labeled with the numbers from 1 to 4, the number on the side facing down will used as the value of the die.

A game is made up of rounds, a single round is played as such:

1. The player rolls their four dice:

d1 = (int)(Math.random() * 4) + 1;

d2 = (int)(Math.random() * 4) + 1;

d3 = (int)(Math.random() * 4) + 1;

d4 = (int)(Math.random() * 4) + 1;

d1, d2, d3, d4 declared as type int before the game loop.

2. The dice are displayed, in some reasonable format.

3. A determination is made as to whether or not the player has won the round. The player loses the round unless they have one of the following:

A Quad: all the dice have the same number on their bottom faces.

A Straight: the numbers on the dice bottom faces can be arranged to form the consecutive sequence: 1 2 3 4.

A Triple all but one of the dice have the same number on their bottom faces.

A TwoPair : two dice have the same number on their bottom faces, and both of the remaining dice also have the same number on their bottom faces - which is distinct from the value of the first pair of dice.

A HighPair is when (exactly) two dice have the number 4 on their bottom faces, and (exactly) one of the remaining dice has the number 3 on its bottom face.

4. The result of the round (with respect to the Player) is reported.

The player is asked if they wish to play another round.

Once the player indicates that they do not wish to play another round: Before exiting, the program displays a short report stating how many rounds were played, of those - how many were won and how many were lost.

Grading:

Performance Indicator [1] [2] [3]

Readability and documentation 0 1 1

Use of if statements 1 2 2

Use of while loops 1 2 2

Functional requirements 2 3 4

Efficiency 0 1 1

Sample run(s):

Welcome to Computer Dice

-----------------------------------------

You will first roll your dice

Next the outcome of your roll will be determined:

any Quad and you Win

any Straight and you Win

any Triple and you Win

any HighPair (4s with a 3) and you Win

anything else and you Lose

-----------------------------------------

Player

-----------

2 2 4 3

Sorry, you lose!

Do you wish to play again [y, n] : 5

Do you wish to play again [y, n] : gfddf

Do you wish to play again [y, n] : y

Player

-----------

4 3 2 4

Congrats, you win!

Do you wish to play again [y, n] : y

Player

-----------

4 4 3 4

Congrats, you win!

Do you wish to play again [y, n] : y

Player

-----------

1 3 2 4

Congrats, you win!

Do you wish to play again [y, n] : y

Player

-----------

3 1 2 1

Sorry, you lose!

Do you wish to play again [y, n] : n

Computer Dice Results

---------------------

You played 5 rounds

Rounds won :3

Rounds lost :2

---------------------

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!