| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- public class Check implements Payment {
- private String payerName;
- private String routingNumber;
- private String accountNumber;
- private long id;
-
- public Check(){
-
- }
-
- public Check( long id, String payerName, String routingNumber, String accountNumber){
- this.id = id;
- this.payerName = payerName;
- this.accountNumber = getLastFourAccountNumber(accountNumber);
- this.routingNumber = routingNumber;
-
-
- }
-
- public void setId(long id){
-
- this.id = id;
- }
- public long getId() {
- return id;
- }
-
- public String getShortDescription() {
- return "Check " + getPayerName() + " " + "***" + getAccountNumber();
- }
-
-
- public String getLastFourAccountNumber(String accountNumber){
-
- return accountNumber.replace(accountNumber.substring(0, accountNumber.length()-4), "");
-
- }
-
-
- public void setPayerName(String payerName) {
- this.payerName = payerName;
- }
-
- public String getPayerName() {
- return payerName;
- }
-
- public void setRoutingNumber(String routingNumber) {
- this.routingNumber = routingNumber;
- }
-
- public String getRoutingNumber() {
- return routingNumber;
- }
-
- public void setAccountNumber(String accountNumber){
- this.accountNumber = accountNumber;
- }
-
- public String getAccountNumber(){
- return accountNumber;
- }
-
- public int compareTo(Payment o) {
-
-
- if (this.getShortDescription().compareTo(o.getShortDescription()) > 0) return 1;
-
- else if (this.getShortDescription().compareTo(o.getShortDescription()) < 0)return -1;
-
- else return 0;
- }
- }
|