Question: In games with two dice (such as Monopoly), rolling two 6-sided dice and getting the same side or number on both dice is called


In games with two dice (such as Monopoly), rolling two 6-sided dice

In games with two dice (such as Monopoly), rolling two 6-sided dice and getting the same side or number on both dice is called "doubles" (i.e. the first die rolls a 5 and the second die rolls a 5 at the same time). One special type of "doubles" roll is called "snake eyes," which is rolling two 1's at the same time. For this assignment you will be writing a program which first prompts the user for the number of sides to the dice they will be rolling. Your user should be able to input any positive value greater than or equal to 3 for the # of the sides on their dice, and you can assume that they will enter integers (not floats or strings). You will need to validate their input before you continue (i.e. entering -10 should cause your program to tell the user that their input is invalid). You should re-prompt the user to enter a value if they supply bad data. Hint: use a "while" loop to keep the user "trapped" until they supply you with "good" data. 8 N 2 20 12 2 Some multi-sided dice Next, your program should keep "rolling the dice" until it gets snake eyes. This means that you will roll two virtual dice of the specified size at a time. The program should "announce" every pair rolled and then tell the user how many "rolls" were required to get a pair of ones. You should also keep track of how many times your roll came up with "doubles" along the way (but you shouldn't end the program until you roll "snake eyes") In addition, you will want to calculate the average roll for each die and present this information to the user. See the sample program below to see what this should look like. You should format this number to two decimal places. # Sample input: How many sides on your dice? -10 Sorry, that's not a valid size value. Please enter a size of at least 3. How many sides on your dice? 6 Thanks! Here we go... # Sample output: 1. die number 1 is 5 and die number 2 is 3. 2. die number 1 is 2 and die number 2 is 2. 3. die number 1 is 1 and die number 2 is 5. 4. die number 1 is 5 and die number 2 is 1. # The loop continues until... 16. die number 1 is 1 and die number 2 is 1. You got snake eyes! Finally! On try number 16! Along the way you rolled doubles 5 times The average roll for die #1 was 2.95 The average roll for die #2 was 3.20

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 Programming Questions!