Rollin’ Dice!

Name this program Rollin1 Write a program that will roll a die a given number of times and display the results of each roll, followed by the sum of all rolls as shown in the example below:

How many rolls? 5

Roll 1: 3     Total: 3

Roll 2: 2     Total: 5

Roll 3: 6     Total: 11

Roll 4: 1     Total: 12

Roll 5: 2     Total: 14

Name this program Rollin2 Write a program that will roll two dice 1000 times and count the number of “doubles”. See the example below:

Roll 1: 3 and 4

Roll 2: 1 and 1  DOUBLES!

Roll 3: 5 and 2

Roll 4: 6 and 2

Roll 5: 5 and 5  DOUBLES!

Roll 6: 3 and 4

# of doubles: 183

Name this program Rollin3 Write a program that will roll THREE dice 1000 times and count the number of “triples”. See the example below:

Roll 1: 3 and 4 and 5

Roll 2: 1 and 1 and 3

Roll 3: 2 and 2 and 2  TRIPLES!

Roll 4: 6 and 2 and 2

Roll 5: 5 and 4 and 6

Roll 6: 3 and 4 and 3

# of triples: 32

Name this program Rollin4 Write a program that will roll a die until you get a 6. See the example below:

Roll 1: 3

Roll 2: 2

Roll 3: 4

Roll 4: 6

DONE!

Name this program Rollin5 Write a program that will roll a die until you get a sum of 25 or more. See the example below:

Roll 1: 3     Total: 3

Roll 2: 2     Total: 5

Roll 3: 6     Total: 11

Roll 4: 1     Total: 12

Roll 5: 2     Total: 14

Roll 6: 4     Total: 18

Roll 7: 3     Total: 21

Roll 8: 5     Total: 26

DONE!

Name this program Rollin6 Write a program that will roll two dice until they are the same. See the example below:

Roll 1: 3 4

Roll 2: 2 1

Roll 3: 4 6

Roll 4: 5 5

DONE!

Name this program Rollin7 Write a program that will roll two dice until their sum is 7 or 11. See the example below:

Roll 1: 3 + 5 = 8

Roll 2: 1 + 2 = 3

Roll 3: 6 + 4 = 10

Roll 4: 2 + 5 = 7

DONE!

Name this program Rollin8 Write a program that will roll two dice until one of them is a 6. See the example below:

Roll 1: 3 and 4

Roll 2: 1 and 1

Roll 3: 5 and 2

Roll 4: 6 and 2

DONE!

Name this program Rollin9 Write a program that will play the following game. In the game, you start with \$20. For each play of the game, you roll two dice. If the sum of the dice is 3, 7 or 11 you win \$3 (it is added to your total). If the sum is any other number, you lose \$2 (it is subtracted from your total). Play the game until you run out of money (when your total is less than or equal to 0). See the example below:

Starting amount: \$20

Roll 1: 3 + 5 = 8       Total: \$18

Roll 2: 1 + 6 = 7       Total: \$21

Roll 3: 6 + 4 = 10      Total: \$19

Roll 4: 2 + 1 = 3       Total: \$22

ETC…

Name this program Rollin10 Write a program that will play the following game. In the game, you start with \$20. For each play of the game, you roll two dice. If the sum of the dice is less than 6 you win \$1 (it is added to your total). If the sum of the dice is greater than 9 you win \$3 (it is added to your total). If the sum is any other number, you lose \$2 (it is subtracted from your total). Play the game until you run out of money (when your total is less than or equal 0). See the example below:

Starting amount: \$20

Roll 1: 3 + 2 = 5       Total: \$21

Roll 2: 1 + 6 = 7       Total: \$19

Roll 3: 6 + 4 = 10      Total: \$22

Roll 4: 5 + 4 = 9       Total: \$20

ETC…