Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your Task Code the Lucky Doubles dice gome as shown in the three sample runs shown below. Here are the basic rules of the game:

Your Task
Code the Lucky Doubles dice gome 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 51. The player may buy as many rolls as desired
The two die numbers (each 1-6) are randomly generated for each roll.
The player wins when they roll a double (i.e, two of a kind). The prize is the foce value of the dice
In dollars. For example, two slxes will win the plaver 512
Your game will report all rolls to the player and kees track of the plaver's money tocal.
Use s loop to execute the proper number of rolls.
Below are three sample runs to demonstrate game behavior. User input is highlighted in yellow to
distineuish between input and output.
SAMPLE RUN #1(WINHING SCEMARIO - FIVE ROLLS (55 cost) AND a $10 WIN)
Step right up to plav LUCKY DOUBLES [IIII
One roll of the dise costs $1.00
One roll of the dice costs S1.00. If you roll *', you'll win the FACE VALUE of your dice in SS,
Resdy? Enter number of rolls: 5
Die1 is 3 and die 2 is 4. No luck here
Die1 is 1 and die 2 is 3. No luck here.
Die1 is 5 and die2 is 5.*+!! YOU WON $10.00!! CONGRATULATIONS!
Die1 is 1 and die 2 is 4. No luck here.
Die1 is 2 and die 2 is 1. No luck here.
Your final tatal is $5.00. Congratulationsi You came out ahesd
SAMPLE RUN $2(LO5IHG SCEMARUO - TEN ROLLS (510 CO5T) AND ONLY A SINGLE $2 WIN):
One roll of the dice costs 5100.
One roll of the dice casts $100. If you roll , you'll win the FACE VALUE of your dise in $5
Ready? Enter number of rolls: 4
Die1 is 3 and die2 is 4. No luck here.
Died is 4 and diez is 6. No luck here
Die 1 is 1 and die 2 is 4. No luck here
Your final total is $0.00. You broke even.
image text in transcribed

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

Question

When should the last word in a title be capitalized?

Answered: 1 week ago