Bladeren bron

feature branch synched with team branch

Jacob Andersen 6 jaren geleden
bovenliggende
commit
55635cca39

BIN
.DS_Store Bestand weergeven


+ 12
- 0
pom.xml Bestand weergeven

@@ -7,6 +7,18 @@
7 7
     <groupId>io.zipcoder</groupId>
8 8
     <artifactId>casino</artifactId>
9 9
     <version>1.0-SNAPSHOT</version>
10
+    <build>
11
+        <plugins>
12
+            <plugin>
13
+                <groupId>org.apache.maven.plugins</groupId>
14
+                <artifactId>maven-compiler-plugin</artifactId>
15
+                <configuration>
16
+                    <source>8</source>
17
+                    <target>8</target>
18
+                </configuration>
19
+            </plugin>
20
+        </plugins>
21
+    </build>
10 22
 
11 23
     <dependencies>
12 24
         <dependency>

BIN
src/.DS_Store Bestand weergeven


BIN
src/main/.DS_Store Bestand weergeven


BIN
src/main/java/.DS_Store Bestand weergeven


BIN
src/main/java/io/.DS_Store Bestand weergeven


BIN
src/main/java/io/zipcoder/.DS_Store Bestand weergeven


+ 0
- 17
src/main/java/io/zipcoder/casino/BlackJackPlayer.java Bestand weergeven

@@ -1,17 +0,0 @@
1
-package io.zipcoder.casino;
2
-
3
-import java.util.ArrayList;
4
-
5
-public class BlackJackPlayer extends Player {
6
-    public BlackJackPlayer(Wallet wallet, double bet) {
7
-        super(wallet, bet);
8
-    }
9
-
10
-    // private ArrayList  hand;
11
-
12
-
13
-
14
-
15
-}
16
-
17
-

+ 29
- 0
src/main/java/io/zipcoder/casino/Card.java Bestand weergeven

@@ -0,0 +1,29 @@
1
+package io.zipcoder.casino;
2
+
3
+public class Card {
4
+    private Suit suit;
5
+    private Rank rank;
6
+
7
+    public Card(Suit suit,Rank rank)
8
+    {
9
+        this.suit = suit;
10
+        this.rank = rank;
11
+    }
12
+
13
+    public Card() {
14
+
15
+    }
16
+
17
+    public Suit getSuit() {
18
+        return suit;
19
+    }
20
+
21
+    public Rank getRank() {
22
+        return rank;
23
+    }
24
+
25
+    public int getValue()
26
+    {
27
+    return rank.getPrimaryValue();
28
+    }
29
+}

+ 26
- 0
src/main/java/io/zipcoder/casino/Dealer.java Bestand weergeven

@@ -0,0 +1,26 @@
1
+package io.zipcoder.casino;
2
+
3
+import java.util.ArrayList;
4
+
5
+public class Dealer {
6
+    private double wallet;
7
+    private ArrayList<String> hand;
8
+    private double Bet;
9
+
10
+    public Dealer(double wallet, ArrayList<String>hand, double Bet)
11
+    {
12
+        this.wallet=wallet;
13
+        this.hand=hand;
14
+    }
15
+
16
+    public void Deal()
17
+    {
18
+
19
+    }
20
+
21
+    public void TakeBet()
22
+    {
23
+
24
+    }
25
+
26
+}

+ 34
- 0
src/main/java/io/zipcoder/casino/Deck.java Bestand weergeven

@@ -0,0 +1,34 @@
1
+package io.zipcoder.casino;
2
+
3
+import java.util.ArrayList;
4
+import java.util.Stack;
5
+
6
+
7
+public class Deck extends Card
8
+{
9
+    private ArrayList<Card> CardDeck;
10
+
11
+    public Deck(ArrayList<Card> CardDeck)
12
+    {
13
+        super();
14
+        this.CardDeck = CardDeck;
15
+    }
16
+
17
+    Stack<Card> tabledeck = new Stack<>();
18
+
19
+    public void PopulateDeck()
20
+    {
21
+        Deck newdeck = new Deck();
22
+
23
+        for(int i=0;i<=3;i++)
24
+        {
25
+            for(int j=0;j<13);
26
+            { newdeck.add()
27
+
28
+            }
29
+        }
30
+
31
+    }
32
+
33
+
34
+}

+ 0
- 39
src/main/java/io/zipcoder/casino/Player.java Bestand weergeven

@@ -1,39 +0,0 @@
1
-package io.zipcoder.casino;
2
-
3
-public class Player {
4
-    private Wallet wallet;
5
-    private double bet;
6
-   // private  double hand;
7
-
8
-    public Player(Wallet wallet, double bet) {
9
-        this.bet = bet;
10
-        this.wallet=wallet;
11
-    }
12
-
13
-
14
-    public void play(){
15
-
16
-    }
17
-
18
-
19
-    public void bet (double money) {
20
-
21
-       this.bet = money;
22
-    }
23
-
24
-
25
-    public double getBet() {
26
-
27
-        return bet;
28
-    }
29
-
30
-    public void addWining(){
31
-
32
-        this.wallet.addMoney(bet);
33
-    }
34
-
35
-    public void subtractLoss ()
36
-    {
37
-        this.wallet.takeMoney(bet);
38
-    }
39
-}

+ 40
- 0
src/main/java/io/zipcoder/casino/Rank.java Bestand weergeven

@@ -0,0 +1,40 @@
1
+package io.zipcoder.casino;
2
+
3
+public enum Rank {
4
+    ACE(1, 11),
5
+    TWO(2),
6
+    THREE(3),
7
+    FOUR(4),
8
+    FIVE(5),
9
+    SIX(6),
10
+    SEVEN(7),
11
+    EIGHT(8),
12
+    NINE(9),
13
+    TEN(10),
14
+    JACK(10),
15
+    QUEEN(10),
16
+    KING(10);
17
+
18
+    private int primaryValue;
19
+    private int secondaryValue;
20
+
21
+    Rank(int primaryValue)
22
+    {
23
+        this.primaryValue = primaryValue;
24
+        this.secondaryValue = primaryValue;
25
+    }
26
+
27
+    Rank(int primaryValue, int secondaryValue)
28
+    {
29
+        this.primaryValue = primaryValue;
30
+        this.secondaryValue = secondaryValue;
31
+    }
32
+
33
+    public int getPrimaryValue() {
34
+        return primaryValue;
35
+    }
36
+
37
+    public int getSecondaryValue() {
38
+        return secondaryValue;
39
+    }
40
+}

+ 22
- 0
src/main/java/io/zipcoder/casino/Suit.java Bestand weergeven

@@ -0,0 +1,22 @@
1
+package io.zipcoder.casino;
2
+
3
+public enum Suit {
4
+    DIAMOND("♦"),
5
+    CLUBS("♣"),
6
+    SPADES("♠"),
7
+    HEART("♥");
8
+
9
+    private final String Symbol;
10
+
11
+    Suit(String Symbol)
12
+    {
13
+        this.Symbol = Symbol;
14
+    }
15
+
16
+    public String getSymbol()
17
+    {
18
+        return Symbol;
19
+    }
20
+
21
+
22
+}

+ 15
- 20
src/main/java/io/zipcoder/casino/Wallet.java Bestand weergeven

@@ -1,38 +1,33 @@
1 1
 package io.zipcoder.casino;
2 2
 
3 3
 public class Wallet {
4
+
4 5
     private double money;
5
-    private  String id;
6
+    private String id;
6 7
 
7
-    public Wallet(double money, String id) {
8
-        this.money = money;
9
-        this.id = id;
8
+    public Wallet(id, money)
9
+    {
10
+        this.id=id;
11
+        this.money=money;
10 12
     }
11 13
 
14
+    public void IncreaseMoney()
15
+    (
12 16
 
13
-    public double getMoney() {
14
-
15
-        return money;
16
-    }
17
-
17
+            )
18 18
 
19
-    public String getId() {
19
+    public void DecreaseMoney()
20
+    {
20 21
 
21
-        return id;
22 22
     }
23 23
 
24
-    public void setId(String id) {
24
+    public String getId()
25
+    {
25 26
 
26
-        this.id = id;
27 27
     }
28 28
 
29
-    public void addMoney(double amount){
30
-        money += amount;
31
-
32
-
33
-    }
34
-    public void takeMoney(double amount){
29
+    public void Setid()
30
+    {
35 31
 
36
-        money -= amount;
37 32
     }
38 33
 }

+ 8
- 1
src/test/java/io/zipcoder/casino/CasinoTest.java Bestand weergeven

@@ -1,5 +1,12 @@
1 1
 package io.zipcoder.casino;
2 2
 
3 3
 
4
+import org.junit.Test;
5
+
4 6
 public class CasinoTest {
5
-}
7
+    @Test
8
+    public CardTest() {
9
+        Card newcard = new Card(Suit.HEART, Rank.TWO);
10
+        System.out.println(newcard);
11
+    }
12
+}

+ 0
- 8
src/test/java/io/zipcoder/casino/TestPlayer.java Bestand weergeven

@@ -1,8 +0,0 @@
1
-package io.zipcoder.casino;
2
-
3
-import org.junit.Test;
4
-
5
-public class TestPlayer {
6
-    @Test
7
-    public
8
-}

+ 0
- 79
src/test/java/io/zipcoder/casino/TestWallet.java Bestand weergeven

@@ -1,79 +0,0 @@
1
-package io.zipcoder.casino;
2
-
3
-import org.junit.Assert;
4
-import org.junit.Test;
5
-
6
-public class TestWallet {
7
-
8
-    @Test
9
-    public void getBalance(){
10
-        Wallet wallet= new Wallet(0.0, "Nury H.");
11
-        //given
12
-       double amount = 100;
13
-       wallet.addMoney(amount);
14
-       //when
15
-        double actual = wallet.getMoney();
16
-        //then
17
-        Assert.assertEquals(amount, actual, 0.0);
18
-
19
-       }
20
-
21
-
22
-
23
-    @Test
24
-    public void testGetId(){
25
-        //given
26
-        Wallet wallet= new Wallet(0.0, "Nury H.");
27
-        String expected = "Nury H.";
28
-
29
-        //when
30
-        String actual = wallet.getId();
31
-        //then
32
-        Assert.assertEquals(expected, actual);
33
-
34
-    }
35
-
36
-
37
-    @Test
38
-    public void testSetid(){
39
-        //given
40
-        Wallet wallet= new Wallet(0.0, "Nury H.");
41
-        wallet.setId("Dayhani");
42
-
43
-        //when
44
-        String actual = wallet.getId();
45
-        //then
46
-        Assert.assertEquals("Dayhani", actual);
47
-
48
-    }
49
-
50
-    @Test
51
-    public void addMoney(){
52
-        Wallet wallet= new Wallet(100.00, "Nury H.");
53
-        //given
54
-        double amount = 100.00;
55
-        wallet.addMoney(amount);
56
-        //when
57
-        double actual = wallet.getMoney();
58
-        //then
59
-        Assert.assertEquals(200.00, actual,0.01);
60
-
61
-    }
62
-
63
-    @Test
64
-    public void takeMoney(){
65
-        Wallet wallet= new Wallet(230.00, "Nury H.");
66
-        //given
67
-        double amount = 75.00;
68
-        wallet.takeMoney(amount);
69
-        //when
70
-        double actual = wallet.getMoney();
71
-        //then
72
-        Assert.assertEquals(155.00, actual, 0.01);
73
-
74
-    }
75
-
76
-
77
-
78
-
79
-}