Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code the Lucky Doubles dice game as shown in the three sample runs shown below. Here are the basic rules of the game: One roll
Code the Lucky Doubles dice game as shown in the three sample runs shown below.
Here are the basic rules of the game:
One roll of the pair of dice costs $ The player may buy as many rolls as desired.
The two die numbers each are randomly generated for each roll.
The player wins when they roll a double ie two of a kind The prize is the face value of the dice
in dollars. For example, two sixes will win the player $
Your game will report all rolls to the player and keep track of the player's money total.
Use a loop to execute the proper number of rolls.
Below are three sample runs to demonstrate game behavior. User input is highlighted in yellow to
distinguish between input and output.
SAMPLE RUN #WINNING SCENARIO FIVE ROLLS $ cost AND a $ WIN
Step right up to play LUCKY DOUBLES
One roll of the dice costs $
If you roll LUCKY DOUBLES you'll win the FACE VALUE of your dice in $$
Ready? Enter number of rolls:
Die is and die is No luck here.
Die is and die is No luck here.
Die is and die is YOU WON $ CONGRATULATIONS!
Die is and die is No luck here.
Die is and die is No luck here.
Your final total is $ Congratulations! You came out ahead!
SAMPLE RUN #LOSING SCENARIO TEN ROLLS $ COST AND ONLY A SINGLE $ WIN:
Step right up to play LUCKY DOUBLES
One roll of the dice costs $
If you roll you'll win the FACE VALUE of your dice in $$
Ready? Enter number of rolls:
Die is and die is No luck here.
Die is and die is No luck here.
Die is and die is No luck here.
Die is and die is No luck here.
Die is and die is No luck here.
Die is and die is No luck here.
Die is and die is No luck here.
Die is and die is LUCKY DOUBLES YOU WON $ CONGRATULATIONS!
Die is and die is No luck here.
Die is and die is No luck here.
Your final total is $ Sorry, but the house always wins.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started