Simran Bhutani il y a 6 ans
Parent
révision
de46abe8a5

+ 2
- 2
src/main/java/io/zipcoder/casino/Casino.java Voir le fichier

@@ -66,9 +66,9 @@ public class Casino {
66 66
 
67 67
                 case 4:
68 68
                     int slotBet1= console.getIntFromUser("Enter the amount you want to bet on Slot");
69
-                    if ((slotBet1 < 0) || (slotBet1 >100) )
69
+                    if ((slotBet1 < 0) || (slotBet1 >player.getCurrentBalance()) )
70 70
                     {
71
-                        Printer.printMessage("Invalid bet amount entered, min bet for slot is $1 and max $100 ");
71
+                        Printer.printMessage("Invalid bet amount entered, you don't have that much money!");
72 72
                         break;
73 73
                     }
74 74
                     Game slot= new SlotMachine(slotBet1, player);

+ 4
- 3
src/test/java/io/zipcoder/casino/SlotTest.java Voir le fichier

@@ -9,10 +9,11 @@ import java.util.Random;
9 9
 
10 10
 
11 11
 public class SlotTest {
12
+    Player player = new Player("Bob", 400);
12 13
     private int betAmount = 10;
13
-    private SlotMachine slotmachine = new SlotMachine(betAmount);
14
+    private SlotMachine slotmachine = new SlotMachine(betAmount, player);
15
+
14 16
 
15
-    Player player = new Player("Bob", 400);
16 17
 
17 18
     @Test
18 19
     public void testSlotResult1(){
@@ -122,7 +123,7 @@ public class SlotTest {
122 123
     @Test
123 124
     public void testSetBetAmount(){
124 125
         int betAmount=10;
125
-        SlotMachine slotmachine = new SlotMachine(betAmount);
126
+        SlotMachine slotmachine = new SlotMachine(betAmount, player);
126 127
 
127 128
         int newBet = 40;
128 129