Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. public class Card {
  2.  
  3. // Create a card ..
  4. // each card has a color and a rank (value of card)
  5. private Color color;
  6. private Rank rank;
  7.  
  8.  
  9. private String cardKeyCode;
  10.  
  11.  
  12. public Card(Color color, Rank rank, String cardKeyCode) {
  13. this.color = color;
  14. this.rank = rank;
  15. this.cardKeyCode = cardKeyCode;
  16. }
  17.  
  18. public String getColor() {
  19. return color.printColor();
  20. }
  21.  
  22. public Card getCard(){
  23. return new Card(color, rank, cardKeyCode);
  24. }
  25.  
  26. public int getRank() {
  27. return rank.printRank();
  28. }
  29.  
  30. public String getCardKeyCode() {
  31. return cardKeyCode;
  32. }
  33.  
  34.  
  35.  
  36. public String toString() {
  37. if (color.printColor().equalsIgnoreCase("Black")) {
  38. if (rank.printRankToString().equalsIgnoreCase("15")) {
  39. return "The card is a SKIP worth "
  40. + rank.printRank() + " points";
  41. } else {
  42. return "The card is a WILD worth "
  43. + rank.printRank() + " points";
  44. }
  45.  
  46. }
  47. return "The card is a " + color.printColor() + " "
  48. + rank.printRank() + " with a keycode of - " + getCardKeyCode();
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement