Просмотр исходного кода

Msldkfjerge branch 'dev' of https://git.zipcode.rocks/fosteric/ZCW-OOP-Casino into dev

Eric Foster 6 лет назад
Родитель
Сommit
d4f6c67aa7
1 измененных файлов: 7 добавлений и 4 удалений
  1. 7
    4
      src/main/java/io/zipcoder/casino/Leviathan/Casino.java

+ 7
- 4
src/main/java/io/zipcoder/casino/Leviathan/Casino.java Просмотреть файл

@@ -2,13 +2,16 @@ package io.zipcoder.casino.Leviathan;
2 2
 
3 3
 
4 4
 public class Casino {
5
-    Console aConsole = new Console();
6
-    Player aPlayer;
7
-    Table aTable;
5
+    private Console aConsole = new Console();
6
+    private Player aPlayer;
8 7
 
9 8
     public void setaPlayer() {
10 9
         String name = aConsole.getStringInput("What is your name?");
11 10
         aPlayer = new Player(name.substring(0, 1).toUpperCase() + name.substring(1),0,aConsole.getIntInput("What is your age?"));
11
+        checkAge();
12
+    }
13
+
14
+    private void checkAge(){
12 15
         if (aPlayer.getAge() > 20) {
13 16
             aPlayer.setTotalChips(aConsole.getIntInput("How many chips would you like to purchase?"));
14 17
         } else {
@@ -17,7 +20,7 @@ public class Casino {
17 20
     }
18 21
 
19 22
     public void run() {
20
-        aTable = new Table(aPlayer);
23
+        Table aTable = new Table(aPlayer);
21 24
         aTable.startGame();
22 25
     }
23 26
 }