Program 3: Craps Simulator

Purpose
The purpose of this programming assignment is to help you gain experience using decision statements.
Program ObjectiveSimulate one million (1,000,000) games of craps to estimate the percent of time that the player wins. Note: the mathematical answer is 49.2929% but due to the vagaries of random number generation, your program is unlikely to produce this answer exactly.Craps RulesCraps involves rolling two six-sided dice:
If you roll a total of 7 or 11 on the first roll, you win.
If you roll a total of 2, 3 or 12 on the first roll, you lose.
If you roll a total of 4, 5, 6, 8, 9 or 10 on the first roll, continue to roll the two dice until you either (1) roll the original total again in which case you win or (2) roll a total of 7 in which case you lose.
Requirements
Create a BlueJ project named Program3.
Create a class named CrapsSimulator and copy this code into that class. Do not modify this code, but make sure you understand it before beginning this assignment.
Supply the missing CrapsGame class such that when the main method of the CrapsSimulator class is run, it produces an accurate estimate of how often a player wins when playing Craps.
Grading - 100 points
5 points - the getGameWon() method is correct.
10 points - the comeOutRoll() method is correct.
10 points - the nextRoll() method is correct.
10 points - the finished() method is correct.
10 points - a private rollDie() method is defined and used correctly. The method should simulate one six-sided die being rolled. The method should return a random number between 1 and 6.
5 points - an appropriate Javadoc comment appears at the top of the CrapsGame class.
10 points (2 points each) - an appropriate Javadoc comment appears above each of the five methods described above.
10 points - the comeOutRoll() method uses at most two decision statements.
5 points - the nextRoll() method uses at most two decision statements.
5 points - the finished() method body contains one line of code.
20 points (all or nothing) - the simulation produces an answer that is no lower than 49.2000 and no greater than 49.4000.
Powered by