Question: Write a complete java program that plays a single game of craps, displays the individual rolls and reports when a game is LOST or WON

Write a complete java program that plays a single game of craps, displays the individual rolls and reports when a game is LOST or WON and shows the number of rolls used by the game.

The algorithm is as follows:

Simulate the roll of 2 dice using a JAVA random number generator.

Record the sum of this first roll as the game point and print out: Game point:

(if) the game point is 7 or 11 print out: Game won in 1 roll

(else) continue rolling the dice. After each roll, print:

(if) a roll is either 7 or 11 print out: Game lost in rolls. Sorry.

(else if) a roll equal the game point print out: Game won in rolls. Congratulations!

Otherwise, repeat step 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!