-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCard.java
More file actions
74 lines (56 loc) · 1.31 KB
/
Card.java
File metadata and controls
74 lines (56 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//Sean Walker
//Poker - Card Class
//this is a card class that contains attributes of cards in enums
public class Card {
private Suit suit;
private Rank rank;
public Card(Suit s, Rank r)
{
suit = s;
rank = r;
}
public static enum Suit{
CLUBS('C'), DIAMONDS('D'), HEARTS('H'), SPADES('S');
private char suitLetter;
Suit(char suitLetter){
this.suitLetter = suitLetter;
}
public char getSuitChar(){
return suitLetter;
}
}//end Suit enum
public static enum Rank{
TWO('2'), THREE('3'), FOUR('4'), FIVE('5'), SIX('6'), SEVEN('7'), EIGHT('8'),
NINE('9'), TEN('T'), JACK('J'), QUEEN('Q'), KING('K'), ACE('A');
private char rankLetter;
Rank(char symbol){
this.rankLetter = symbol;
}
public char getRankLetter() {
return this.rankLetter;
}
public void setRankLetter(char rankLetter) {
this.rankLetter = rankLetter;
}
}//end Rank enum
//get chars that represent enums
public char getRankChar(){
return this.rank.rankLetter;
}
public char getSuitChar(){
return this.suit.suitLetter;
}
//get enums:
public Rank getRankEnum(){
return this.rank;
}
public Suit getSuitEnum(){
return this.suit;
}
public void setSuitEnum(Suit suit){
this.suit.equals(suit);
}
public void setRankEnum(Rank rank){
this.rank.equals(rank);
}
}//end Card class