mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-21 23:00:43 -08:00
Make Suit an enum in Card
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
public class Card {
|
public class Card {
|
||||||
|
|
||||||
|
public enum Suit {
|
||||||
|
HEARTS, DIAMONDS, SPADES, CLUBS;
|
||||||
|
}
|
||||||
|
|
||||||
private int value;
|
private int value;
|
||||||
private String suit;
|
private Suit suit;
|
||||||
|
|
||||||
public void setValue(int value) {
|
public void setValue(int value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
@@ -10,11 +15,11 @@ public class Card {
|
|||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSuit(int suit) {
|
public void setSuit(Suit suit) {
|
||||||
this.suit = suit;
|
this.suit = suit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSuit() {
|
public Suit getSuit() {
|
||||||
return this.suit;
|
return this.suit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user