Browse Source

Merge branch 'master' of jbedolla40/ZCW-OOP-Casino into master

jonathan-hinds 6 years ago
parent
commit
baedbdcb59

BIN
.DS_Store View File


BIN
src/.DS_Store View File


BIN
src/main/.DS_Store View File


BIN
src/main/java/.DS_Store View File


BIN
src/main/java/io/.DS_Store View File


BIN
src/main/java/io/zipcoder/.DS_Store View File


+ 6
- 1
src/main/java/io/zipcoder/casino/Dice.java View File

1
 package io.zipcoder.casino;
1
 package io.zipcoder.casino;
2
 
2
 
3
 public class Dice {
3
 public class Dice {
4
+
5
+
4
     private int value;
6
     private int value;
5
 
7
 
6
     public void roll(){
8
     public void roll(){
7
 
9
 
10
+        value = (int) (Math.random()*6+1);
11
+
8
         //Generate a random number between 1 and 6
12
         //Generate a random number between 1 and 6
9
         //set value equal to this number
13
         //set value equal to this number
10
 
14
 
11
     }
15
     }
12
 
16
 
13
-    public int getValue() {
17
+    public int getValue()
18
+    {
14
         return value;
19
         return value;
15
     }
20
     }
16
 }
21
 }

+ 27
- 0
src/test/java/io/zipcoder/casino/DiceTest.java View File

1
+package io.zipcoder.casino;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+
6
+public class DiceTest {
7
+
8
+    @Test
9
+    public void getValueTest()
10
+    {
11
+        Dice dice = new Dice();
12
+        dice.roll();
13
+        int actual = dice.getValue();
14
+        boolean expected = true;
15
+        boolean x;
16
+        if (actual<=6 || actual>=1)
17
+        {
18
+            x = true;
19
+        }
20
+        else
21
+            {
22
+                x =false;
23
+            }
24
+
25
+        Assert.assertEquals(expected,x);
26
+    }
27
+}