-
Notifications
You must be signed in to change notification settings - Fork 0
/
Card.java
61 lines (49 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
59
60
61
package BlackJack;
public class Card {
private String pattern;
private String denomination;
private int point;
public Card(String pattern, int index) {
this.pattern = pattern;
this.denomination = this.numberToDenomination(index);
this.point = this.numberToPoint(index);
}
public int getPoint() {
return point;
}
/*
public String getPattern() {
return pattern;
}
public void setPattern(String pattern) {
this.pattern = pattern;
}
public String getDenomination() {
return denomination;
}
public void setDenomination(String denomination) {
this.denomination = denomination;
}*/
private int numberToPoint(int number) {
if(number >= 11) {
return 10;
}
return number;
}
private String numberToDenomination(int number){
if(number == 1){
return "A";
}else if(number == 11){
return "J";
}else if(number == 12){
return "Q";
}else if(number == 13){
return "K";
}
return String.valueOf(number);
}
@Override
public String toString() {
return "Card{" + "pattern='" + pattern + ", denomination='" + denomination + '}';
}
}