Write a program that simulates how often a player would win


The game of Craps is a dice game that involves rolling a pair of dice. At the start of each turn if the player rolls a 7, or 11 they win.

Write a program that simulates how often a player would win if they rolled the dice 100 times.

The program will output a message such as "The player rolled 14 sevens and 5 elevens for a total of 19 wins out of 100."

The program will ask the user if they wish to run another simulation or quit.

Possible Program structure

Create a random number for each dice using either the API Random class or the Math classes' random method.

Create a loop that will loop 100 times.

Within the loop

Store the random number output

if it is a seven or eleven increment the value of the appropriate variable.

Print out the message stating the number of sevens and elevens.

Use the appropriate to type of loop to prompt the user if they like to try again or quit.

Solution Preview :

Prepared by a verified Expert
Programming Languages: Write a program that simulates how often a player would win
Reference No:- TGS01667209

Now Priced at $40 (50% Discount)

Recommended (97%)

Rated (4.9/5)