Paypal.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package com.zipcoder.payment;
  2. public class Paypal implements Payment {
  3. private long id;
  4. private String payerName;
  5. private String email;
  6. public Paypal(int id,String payerName,String email)
  7. {
  8. this.id=id;
  9. this.payerName=payerName;
  10. this.email=email;
  11. }
  12. public long getId()
  13. {
  14. return this.id;
  15. }
  16. public void setId(Long id)
  17. {
  18. this.id=id;
  19. }
  20. public String getPayerName()
  21. {
  22. return this.payerName;
  23. }
  24. public void setPayerName(String name)
  25. {
  26. this.payerName=name;
  27. }
  28. public String getemail()
  29. {
  30. return this.email;
  31. }
  32. public void setemail(String email)
  33. {
  34. this.email=email;
  35. }
  36. public String getShortDescription()
  37. {
  38. // String number=getNumber();
  39. StringBuilder br =new StringBuilder();
  40. br.append("Paypal").append(" ").append(getPayerName()).append(" ")
  41. .append(getemail());
  42. System.out.println(br.toString());
  43. return br.toString();
  44. }
  45. public int compareTo(Payment o) {
  46. int number=0;
  47. if(this.getShortDescription().compareTo(o.getShortDescription())==0)
  48. {
  49. number=0;
  50. }
  51. if(this.getShortDescription().compareTo(o.getShortDescription())<0)
  52. {
  53. number=-1;
  54. }
  55. if(this.getShortDescription().compareTo(o.getShortDescription())>0)
  56. {
  57. number=1;
  58. }
  59. return number;
  60. }
  61. }