| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- package com.zipcoder.payment;
-
- public class CreditCard implements Payment {
- private long id;
- private int month;
- private int year;
- private String number;
- private String name;
-
- public CreditCard(long id, int month, int year, String number, String name){
- this.id = id;
- this.month = month;
- this.year = year;
- this.number = number;
- this.name = name;
- }
- public CreditCard(long id){
- this.id = id;
- }
- public CreditCard(long id,String name,String number){
- this.id=id;
- this.name = name;
- this.number = number;
-
- }
- public CreditCard(String name){
- this.name = name;
- }
- public CreditCard(){
-
- }
-
-
- public long getId() {
- return id;
- }
- public void setId(long id){
- this.id = id;
-
- }
- public void setPayerName(String name){
- this.name = name;
-
- }
- public String getPayerName() {
- return name;
- }
-
- public void setExpiredMonth(int month){
- this.month = month;
-
- }
- public int getExpiredMonth(){
-
- return month;
-
- }
- public void setExpiredYear(int year){
- this.year = year;
-
- }
-
- public int getExpiredYear(){
-
- return year;
-
- }
- public String getNumber(){
-
- return number;
-
- }
- public void setNumber(String number){
- this.number = number;
-
- }
-
-
- public String getShortDescription() {
- return "CC " + getPayerName() +" "+ getNumber() +" "+ getExpiredMonth()+"/"+getExpiredYear();
- }
-
-
- public int compareTo(Payment o) {
-
-
- if(this.getShortDescription().compareTo(o.getShortDescription())== 0){
- return 0;
- }
- else if(this.getShortDescription().compareTo(o.getShortDescription()) < 0){
- return -1;
- }
- else if(this.getShortDescription().compareTo(o.getShortDescription())>0){
- return 1;
- }
- else{
- return 101010;
- }
-
- }
- }
-
|