Question: Please do this in java [20 marks] Craps is a dice game where two dice are rolled. Each die has six faces representing values 1,

 Please do this in java [20 marks] Craps is a dice

Please do this in java

[20 marks] Craps is a dice game where two dice are rolled. Each die has six faces representing values 1, 2, 3, 4, 5, or 6.

If the sum is 2, 3, or 12 (called craps), you lose;

If the sum is 7 or 11 (called natural), you win;

If the sum is any other value (4, 5, 6, 8, 9, or 10), a value point is established, and you continue to roll until you either roll a sum of the value point or a 7. If the sum of the new roll is equal to the value point, then you win; if the sum of the new roll is equal to 7, then you lose.

Remember, in option (III), you continue to roll until you get a 7 or the value point.

Sample runs:

You rolled 5 + 6 = 11; you win

You rolled 1 + 2 = 3; you lose

You rolled 2 + 2 = 4; you establish the value point 4;

Roll again 2 + 3 = 5; roll

Roll again 2 + 1 = 3; roll

Roll again 2 + 2 = 4; you win

You rolled 2 + 6 = 8; you establish the value point 8;

Roll again 4 + 4 = 8; you win

You rolled 3 + 2 = 5; you establish the value point 5;

Roll again 1 + 1 = 2; roll

Roll again 2 + 2 = 4; roll

Roll again 1 + 1 = 2; roll

Roll again 3 + 4 = 7; you lose

Develop a program that plays craps with a player three times. At the end, the program prints the number of times the player won and the number of times the player lost.

RandomSumGame Attributes +boolean start + int d1 + int d2 + int sum + int valuePoint + String status E Operations + public void play(int d1, int d2) + public void play( +public void rollDice)

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!