-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathCard.java
More file actions
63 lines (50 loc) · 1.1 KB
/
Copy pathCard.java
File metadata and controls
63 lines (50 loc) · 1.1 KB
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
package com.polymars.game;
public class Card {
final String[] elements = {"fire", "water", "snow"};
final String[] colors = {"red", "orange", "yellow", "green", "blue", "purple"};
int element;
int value;
int color;
public Card (int element, int value, int color)
{
this.element = element;
this.value = value;
this.color = color;
}
public int getElement()
{
return element;
}
public int getValue()
{
return value;
}
public int getColor()
{
return color;
}
public String getElementAsString()
{
return elements[element];
}
public String getValueAsString()
{
return Integer.toString(value);
}
public String getColorAsString()
{
return colors[color];
}
public String getArticle()
{
if (color == Cards.ORANGE)
{
return "an";
}
return "a";
}
public String toString()
{
return getColorAsString() + " " + getElementAsString() + " card of value " + getValueAsString();
}
}