Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Main topics: User validated input if && if - else Statements Loop Statements Program Specification: Write a program that allows a single Player (the user)

image text in transcribed image text in transcribed image text in transcribed

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 four dice game of chance against "The Odds" Game Description: . There is a single player, with four six sided die The sides of each die are labeled with the numbers from 1 to 6, we will call this 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) *6) + 1; d2 - (int) (Math.random) * 6) + 1; d3 - (int) (Math.random) 6) +1; d4 - (int) (Math.random) * 6) + 1; d1, d2, d3, d4 declared as type int before the game loop 2. The dice are displayed, in some reasonable format 3. The user is given the option to re-roll (upto two of their dice) and specify exactly which die they wish to re-roll. 4. The dice are displayed, in some reasonable format 5. A determination is made as to whether or not the player won the round, this determination is made via the following rules - A Quad is when all the dice have the same number on their top faces. If the player has any Quad then they receive 108 "win"s - A Triple is when exactly three of the dice have the same number on their top faces. If the player has any Triple then they receive 6 "win"s A Two-Pair is when exactly two dice have the number n1 on their top faces and exactly two dice have the number n2 on their top faces ni n2. If the player has any Pair then they receive 4 "win's - A Junker is then anything that is not a listed above If the player has any Junker then they receive 1 "lose". 6. 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, how many were"win"s and how many "lose"s the player received

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions