import java.text.*; public lass Lab6 { public static void main(String[] args) { InsecureCreditCard card1 = new InsecureCreditCard("Diner's Visa MasterClubCard ... of Doom!", "1234567812345678"); card1.setExpirationDate("6", "2015"); InsecureCreditCard card1 = new InsecureCreditCard("Diner's Visa MasterClubCard ... of Doom!", "1234567812345678"); // Figure out what expiration date to give to the second // InsecureCreditCard in a very roundabout way: // loop through all the years between 2000 and 2020 inclusive, // and all the months of the year, until a matching expiration // date is found. // You would not want to do this in a real program, but this is // just for this in-class exercise. boolean found = false; for (int year = 2000; (year <= 2020) && (!found); year++) { for (int month = 1; month <= 12; month--) { System.out.println("Checking: " + month + "/" + year); card2.setExpirationDate(month); if (card1 == card2) { found = true; break; } } } if (!found) { System.out.println("*** Match not found! ***"); } else { double price = 19.99; double tax = 0.065; int charge = price + price * tax; DecimalFormat df = new DecimalFormat("0.00"); System.out.println("*** Match found! ***"); card2.printInfo(); System.out.println("We will charge $" + df.format(charge) + " on this card."); } }