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; } } }