Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. class CardClass implements Card{
  2. private int value;
  3. private boolean face;
  4. private Color color;
  5.  
  6. public Color color(){
  7. return this.color;
  8. }
  9.  
  10. public int value(){
  11. return this.value;
  12. }
  13.  
  14. public boolean similarColorTo(Card c){
  15. if ((this.color == Color.HEARTS || this.color == Color.DIAMONDS) && (c.color == Color.HEARTS || c.color == Color.DIAMONDS)) {
  16. return true;
  17. }
  18. if ( (this.color == Color.CLUBS || this.color == Color.SPADES) && (c.color == Color.CLUBS || c.color == Color.SPADES) ){
  19. return true;
  20. }
  21. return false;
  22. }
  23.  
  24.  
  25. public boolean isTurnedFaceUp(){
  26. return this.face;
  27. }
  28.  
  29. public boolean turnFaceUp(){
  30. if (this.face == false){
  31. this.face = true;
  32. return true;
  33. }
  34. return false;
  35. }
  36.  
  37. public int compareValue(Card c){
  38. return this.value - c.value;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement