CreditCard.java 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package com.zipcoder.payment;
  2. public class CreditCard implements Payment {
  3. private long id;
  4. private String playerName;
  5. private String number;
  6. private int expiredMonth;
  7. private int expiredYear;
  8. public void setId(long id) {
  9. this.id = id;
  10. }
  11. public void setPlayerName(String playerName) {
  12. this.playerName = playerName;
  13. }
  14. public String getNumber() {
  15. return number;
  16. }
  17. public void setNumber(String number) {
  18. this.number = number;
  19. }
  20. public int getExpiredMonth() {
  21. return expiredMonth;
  22. }
  23. public void setExpiredMonth(int expiredMonth) {
  24. this.expiredMonth = expiredMonth;
  25. }
  26. public int getExpiredYear() {
  27. return expiredYear;
  28. }
  29. public void setExpiredYear(int expiredYear) {
  30. this.expiredYear = expiredYear;
  31. }
  32. public long getId() {
  33. return id;
  34. }
  35. public String getPlayerName() {
  36. return playerName;
  37. }
  38. public String getShortDescription() {
  39. return "CC " + playerName + " " + number.substring(number.length() - 4) + " " + expiredMonth + "/" + expiredYear;
  40. }
  41. @Override
  42. public int compareTo(Payment o) {
  43. return this.getShortDescription().compareTo(o.getShortDescription());
  44. }
  45. }