Commit 717a196
Changed files (2)
src
src/Q4/RandomSumGame.java
@@ -0,0 +1,14 @@
+package Q4;
+
+public class RandomSumGame {
+ private boolean start;
+ private int d1;
+ private int d2;
+ private int sum;
+ private int valuePoint;
+ private String status;
+
+ public void play(int d1, int d2) { }
+ public void play() { }
+ public void rollDice() {}
+}
src/Q4/README.md
@@ -6,6 +6,32 @@ Student ID: 3431709
1. Problem Statement:
```text
+Craps is a dice game where two dice are rolled.
+Each die has six faces representing values 1, 2, 3, 4, 5, or 6.
+
+1. If the sum is 2, 3, or 12 (called craps), you lose;
+2. If the sum is 7 or 11 (called natural), you win;
+3. 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.
```
2. Description of the Code: