Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CardClass implements Card{
- private int value;
- private boolean face;
- private Color color;
- public Color color(){
- return this.color;
- }
- public int value(){
- return this.value;
- }
- public boolean similarColorTo(Card c){
- if ((this.color == Color.HEARTS || this.color == Color.DIAMONDS) && (c.color == Color.HEARTS || c.color == Color.DIAMONDS)) {
- return true;
- }
- if ( (this.color == Color.CLUBS || this.color == Color.SPADES) && (c.color == Color.CLUBS || c.color == Color.SPADES) ){
- return true;
- }
- return false;
- }
- public boolean isTurnedFaceUp(){
- return this.face;
- }
- public boolean turnFaceUp(){
- if (this.face == false){
- this.face = true;
- return true;
- }
- return false;
- }
- public int compareValue(Card c){
- return this.value - c.value;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement