Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. The game of Craps is a dice game that involves rolling a pair of dice. At the start of each turn if the players

image text in transcribed

1. The game of Craps is a dice game that involves rolling a pair of dice. At the start of each turn if the players rolls a 7, or 11 they win. 2. Write a program that simulates how often a player would win if they rolled the dice 100 times. 3. 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." 4. The program will ask the user if they wish to run another simulation or quit. 5. Possible Program structure 1. Create a random number for each dice using either the API Random class or the Math classes' random method. 2. Create a loop that will loop 100 times. 3. Within the loop 1. Store the random number output 2. if it is a seven or eleven increment the value of the appropriate variable. 4. Print out the message stating the number of sevens and elevens. 5. Use the appropriate to type of loop to prompt the user if they like to try again or quit

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

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago