mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 23:26:40 -08:00
Add Player and Card objects
This commit is contained in:
21
10_Blackjack/java/src/Card.java
Normal file
21
10_Blackjack/java/src/Card.java
Normal file
@@ -0,0 +1,21 @@
|
||||
public class Card {
|
||||
private int value;
|
||||
private String suit;
|
||||
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public void setSuit(int suit) {
|
||||
this.suit = suit;
|
||||
}
|
||||
|
||||
public int getSuit() {
|
||||
return this.suit;
|
||||
}
|
||||
|
||||
}
|
||||
32
10_Blackjack/java/src/Player.java
Normal file
32
10_Blackjack/java/src/Player.java
Normal file
@@ -0,0 +1,32 @@
|
||||
import Card;
|
||||
|
||||
public class Player {
|
||||
|
||||
private int currentBet;
|
||||
private int total;
|
||||
private LinkedList<Card> hand;
|
||||
|
||||
public void setCurrentBet(int currentBet) {
|
||||
this.currentBet = currentBet;
|
||||
}
|
||||
|
||||
public int getCurrentBet() {
|
||||
return this.currentBet;
|
||||
}
|
||||
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public int getTotal() {
|
||||
return this.total;
|
||||
}
|
||||
|
||||
public void setHand(LinkedList<Card> hand) {
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
public LinkedList<Card> getHand() {
|
||||
return this.hand;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user