Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Obiectives: Java Methods and Arrays (chapters 6 and 7) Write an application that runs 1,000,000 games of craps and answers the following questions: 1) How

image text in transcribed
image text in transcribed
Obiectives: Java Methods and Arrays (chapters 6 and 7) Write an application that runs 1,000,000 games of craps and answers the following questions: 1) How many games are won on the first roll, second roll, third roll,..., twentieth roll, and after the 2) How many games are lost on the first roll, second roll, third roll, . twentieth roll, and after the 3) 4) What is the average length of a game of craps? twentieth roll (all games that take more than 20 rolls are considered one group)? twentieth roll (all games that take more than 20 rolls are considered one group)? What are the chances of winning at craps? [Note: You should discover that craps is one of the fairest casino ga mes. What do you suppose this means?] Below is a reproduced copy of the Craps.java from chapter 6: // Craps.java // Craps class simulates the dice game craps. import java.uti1.Random public class Craps // create random number generator for use in method rollDice private static final Random randomNumbers new RandomO // enumeration with constants that represent the game status private enum Status CONTINUE, WON, LOST // constants that represent common rolls of the dice private static final int SNAKE EYES-2; private static final int TREY 3; private static final int SEVEN7; private static final int YO LEVEN 11; private static final int BOX CARS-12 // plays one game of craps public static void main String[ args int myPoint 0; // point if no win or loss on first roll Status gamestatus; // can contain CONTINUE, WON or LOST int sumofoi ce rollDice(); // first roll of the dice // determine game status and nint hased on first roll 1/2

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions