@@ -0,0 +1,1817 @@
+%0A%0Aimport java.util.Calendar;%0A%0Apublic class CreditCard %7B%0A%09%0A%09// declare objects%0A%09Calendar now = Calendar.getInstance();%0A%09%0A%09// Instance variables%0A%09private int expiryMonth;%0A%09private int expiryYear;%0A%09private String firstName;%0A%09private String lastName;%0A%09private String ccNumber;%0A%09%0A%09// Constructor%0A%09public Exercise3_CreditCard(int expiryMonth, int expiryYear,%0A%09%09%09String firstName, String lastName, String ccNumber) %7B%0A%0A%09%09this.expiryMonth = expiryMonth;%0A%09%09this.expiryYear = expiryYear;%0A%09%09this.firstName = firstName;%0A%09%09this.lastName = lastName;%0A%09%09this.ccNumber = ccNumber;%0A%09%7D%0A%09%0A%09// INSTANCE METHODS%0A%09// formats expiryDate%0A%09public String formatExpiryDate()%7B%0A%09%09String formDate = Integer.toString(expiryMonth) + %22/%22 + Integer.toString(expiryYear).substring(2,4);%0A%09%09return formDate;%0A%09%7D%0A%09%0A%09// formats full name%0A%09public String formatFullName()%7B%0A%09%09String fullName = Character.toString(firstName.charAt(0)).toUpperCase() + firstName.substring(1);%0A%09%09fullName += %22 %22 + Character.toString(lastName.charAt(0)).toUpperCase() + lastName.substring(1);%0A%09%09return fullName;%0A%09%7D%0A%09%0A%09// formats CC Number%0A%09public String formatCCNumber()%7B%0A%09%09StringBuilder sb = new StringBuilder();%0A%09%09sb.append(ccNumber);%0A%09%09int offset = 4;%0A%09%09while (offset %3C= sb.length())%7B%0A%09%09%09sb.insert(offset, %22 %22);%0A%09%09%09offset += 5;%0A%09%09%7D%0A%09%09return sb.toString();%0A%09%7D%0A%09%0A%09// returns true of expiryDate is later than the current value %0A%09public boolean isValid()%7B%0A%09%09int curMonth = now.get(Calendar.MONTH);%0A%09%09int curYear = now.get(Calendar.YEAR);%0A%09%09boolean valid = false;%0A%0A%09%09if (curYear %3C= this.expiryYear && curMonth %3C= this.expiryMonth)%7B%0A%09%09%09valid = true;%0A%09%09%7D%0A%09%09return valid;%0A%09%7D%0A%09%0A%09// prints out account details%0A%09public String toString()%7B%0A%09%09return %22Number: %22 + formatCCNumber() + %22Expiry Date: %22 + formatExpiryDate() + %22 Account holder: %22 + formatFullName() + %22Is valid: %22 + isValid();%0A%09%7D%0A%0A%7D%0A

Create CreditCard.java