-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCard.java
56 lines (50 loc) · 892 Bytes
/
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
public class Card {
private char num;
private char suit;
private int value;
public Card(String x){
this.suit = x.charAt(1);
this.num = x.charAt(0);
switch(num) {
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
value = Integer.parseInt("" + num);
break;
case 'T':
value = 10;
break;
case 'J':
value = 11;
break;
case 'Q':
value = 12;
break;
case 'K':
value = 13;
break;
case 'A':
value = 14;
break;
}
}
public char getNum(){
return this.num;
}
public char getSuit(){
return this.suit;
}
public int getValue(){
return this.value;
}
public String toString(){
String t="";
t += num + "" + suit;
return t;
}
}