-
Notifications
You must be signed in to change notification settings - Fork 0
/
Card.java
58 lines (48 loc) · 1.12 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
//Card
//Creates a card object
//Created By: Umar Tahir
//Last Modified: 6/18/22
public class Card {
// Variable Definition
private int number; // the card number
private int suitd; // the card suit
// Constructor
public Card(int num, int suit) {
number = num;
suitd = suit;
}
// sets the suit
public void setSuit(int suit) {
suitd = suit;
}
// sets the number
public void setNum(int num) {
number = num;
}
// returns the sting value of the suit
public String getSuit() {
String suit;
if (suitd == 0)
suit = "Spades";
else if (suitd == 1)
suit = "Diamonds";
else if (suitd == 2)
suit = "Clubs";
else
suit = "Hearts";
return suit;
}
// returns the number
public int getNum() {
return number;
}
// returns the point value
public int getPointValue() {
int val;
if (this.getNum() < 10)
val = this.getNum();
else
val = 10;
return val;
}
} // end of Client class