package com.devmarvel.creditcardentry.library;

public class CreditCard {
	
	private String cardNumber;
	private String expDate;
	private String securityCode;
	private String zipCode;

	public CreditCard(String cardNumber, String expDate, String securityCode, String zipCode)
	{
		this.setCardNumber(cardNumber);
		this.setExpDate(expDate);
		this.setSecurityCode(securityCode);
		this.setZipCode(zipCode);
	}

	public String getCardNumber() {
		return cardNumber;
	}

	public void setCardNumber(String cardNumber) {
		this.cardNumber = cardNumber;
	}

	public String getExpDate() {
		return expDate;
	}

	public void setExpDate(String expDate) {
		this.expDate = expDate;
	}

	public String getSecurityCode() {
		return securityCode;
	}

	public void setSecurityCode(String securityCode) {
		this.securityCode = securityCode;
	}

	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	@Override
	public String toString() {
		final StringBuilder sb = new StringBuilder("CreditCard{");
		sb.append("cardNumber='").append(cardNumber).append('\'');
		sb.append(", expDate='").append(expDate).append('\'');
		sb.append(", securityCode='").append(securityCode).append('\'');
		sb.append(", zipCode='").append(zipCode).append('\'');
		sb.append('}');
		return sb.toString();
	}
}

@@ -948,16 +948,439 @@
 de;%0A%09%7D%0A%0A
+%09public Integer getExpMonth() %7B%0A%09%09return getDateFragment(0);%0A%09%7D%0A%0A%09public Integer getExpYear() %7B%0A%09%09return getDateFragment(1);%0A%09%7D%0A%0A%09private Integer getDateFragment(int position) %7B%0A%09%09if(expDate != null && expDate.contains(%22/%22)) %7B%0A%09%09%09String%5B%5D split = expDate.split(%22/%22);%0A%09%09%09if(split.length %3E 1) %7B%0A%09%09%09%09try %7B%0A%09%09%09%09%09return Integer.valueOf(split%5Bposition%5D);%0A%09%09%09%09%7D catch (NumberFormatException ignore) %7B%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%0A
 %09@Overri

add convenience methods for getting date parts