PayPal.java 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. public class PayPal implements Payment {
  2. long id;
  3. String payerName;
  4. String email;
  5. public PayPal(long l, String tia_mowry, String s){
  6. this.id = l;
  7. this.payerName = tia_mowry;
  8. this.email = s;
  9. }
  10. public PayPal(long id, String payerName, String number, String email){}
  11. public void setId(long id) {
  12. this.id = id;
  13. }
  14. public long getId() {
  15. return id;
  16. }
  17. public void setPayerName(String payerName){
  18. this.payerName = payerName;
  19. }
  20. public String getPayerName() {
  21. return this.payerName;
  22. }
  23. public void setEmail(String email) {
  24. this.email = email;
  25. }
  26. public String getEmail(){
  27. return this.email;
  28. }
  29. public String getShortDescription() {
  30. return "PayPal " + getPayerName() + " " + getEmail();
  31. }
  32. public int compareTo(Payment o) {
  33. PayPal payPal = new PayPal(4L, "Tia Mowry", "tia@mowry.com");
  34. if ( this.getShortDescription().compareTo(o.getShortDescription()) == 0 )
  35. {return 0;}
  36. else if ( this.getShortDescription().compareTo(o.getShortDescription()) < 0 ){
  37. return 1;}
  38. else return -1;
  39. }
  40. }