Answered step by step
Verified Expert Solution
Link Copied!

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 $1. 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 face value of the dice
in dollars. For example, two sixes will win the player $12.
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 #1(WINNING SCENARIO - FIVE ROLLS ($5 cost) AND a $10 WIN)
Step right up to play LUCKY DOUBLES !!!!
One roll of the dice costs $1.00.
If you roll ** LUCKY DOUBLES**, you'll win the FACE VALUE of your dice in $$.
Ready? Enter number of rolls: 5
Die1 is 3 and die2 is 4. No luck here.
Die1 is 1 and die2 is 3. No luck here.
Die1 is 5 and die2 is 5.! YOU WON $10.00!! CONGRATULATIONS!
Die1 is 1 and die2 is 4. No luck here.
Die1 is 2 and die2 is 1. No luck here.
Your final total is $5.00. Congratulations! You came out ahead!
SAMPLE RUN #2(LOSING SCENARIO - TEN ROLLS ($10 COST) AND ONLY A SINGLE $2 WIN):
Step right up to play LUCKY DOUBLES !!!
One roll of the dice costs $1.00.
If you roll , you'll win the FACE VALUE of your dice in $$.
Ready? Enter number of rolls: 10
Die1 is 4 and die 2 is 3. No luck here.
Die 1 is 6 and die 2 is 1. No luck here.
Die1 is 5 and die 2 is 1. No luck here.
Die1 is 4 and die2 is 1. No luck here.
Die1 is 4 and die2 is 5. No luck here.
Die1 is 1 and die2 is 4. No luck here.
Die1 is 5 and die2 is 3. No luck here.
Die 1 is 1 and die 2 is 1.?**** LUCKY DOUBLES*?****! YOU WON $2.00!! CONGRATULATIONS!
Die 1 is 4 and die 2 is 5. No luck here.
Die1 is 2 and die2 is 1. No luck here.
Your final total is $-8.00. Sorry, but the house always wins.
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_2

Step: 3

blur-text-image_3

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

Review and define each of the chapters key terms.

Answered: 1 week ago

Question

6. Identify seven types of hidden histories.

Answered: 1 week ago

Question

What is the relationship between humans and nature?

Answered: 1 week ago