-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCard.java
More file actions
46 lines (45 loc) · 836 Bytes
/
Card.java
File metadata and controls
46 lines (45 loc) · 836 Bytes
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
public class Card
{
private String value;
private String suit;
public int numValue;
public Card()
{
value = "";
suit = "";
}
public void setValue(String value)
{
if (value.equals("11"))
this.value = "J";
else if (value.equals("12"))
this.value = "Q";
else if (value.equals("13"))
this.value = "K";
else if (value.equals("14"))
this.value = "A";
else
this.value = value;
}
public void setSuit(String suit)
{
if (suit.equals("1"))
this.suit = "hearts";
else if (suit.equals("2"))
this.suit = "spades";
else if (suit.equals("3"))
this.suit = "clubs";
else if (suit.equals("4"))
this.suit = "diamonds";
else
this.suit = suit;
}
public void setNumValue(int numValue)
{
this.numValue = numValue;
}
public String getCard()
{
return (value+" of "+suit);
}
}