-
Notifications
You must be signed in to change notification settings - Fork 0
/
Card.java
66 lines (57 loc) · 1.21 KB
/
Card.java
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
package cardsgame;
public class Card {
// Private fields
private Suit suit;
private Priority priority;
private int value;
// Constructor
public Card(Priority priority, Suit suit, int value) {
this.priority = priority;
this.suit = suit;
this.value = value;
}
/************************************
* PUBLIC METHODS
************************************/
/**
* Method getCardSuit()
*
* @return suit of card
*/
public String getCardSuit() {
return suit.getSuit();
}
/**
* Method getCardPriority()
*
* @return rank of card
*/
public int getCardRank() {
return priority.getPriority();
}
/**
* Method getValue()
*
* @return integer holding value for instance variable _value
*/
public int getValue() {
return value;
}
/**
* Method setValue() sets instance variable value to passed value parameter
*
* @param int value
*/
public void setValue(int value) {
this.value = value;
}
/**
* Method toString()
*
* @return suit and rank of card as a string
*/
@Override
public String toString() {
return "Card [suit=" + suit + ", priority=" + priority + ", value=" + value + "]";
}
}// end Card