-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCard.java
More file actions
39 lines (35 loc) · 842 Bytes
/
Card.java
File metadata and controls
39 lines (35 loc) · 842 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
package game;
/**
* Card class
* @version 1.2
*/
public class Card{
private int value;
/**
* Constructor for a Card
* @param value cards face value
*/
public Card(int value){
this.value = value;
}
/**
* Method gets the cards value
* @return cards face value
*/
public int getValue(){
return value;
}
@Override
/**
* Method compares an object for equivalency with the card instance
* @param obj object to be tested for equivalency with card instance
* @return true if object is equivalent, else false
*/
public boolean equals(Object obj){
if (obj instanceof Card){
if(this.value == ((Card) obj).value)
return true;
}
return false;
}
}