import java.util.ArrayList; class Parlor { private String name; private ArrayList appts = new ArrayList(); Parlor(String name) { this.name = name; for (int i=0; i<=11; i++) { this.appts.add(""); } } int makeAppointment(Customer c, String tattooSize) throws AllBookedException, UnderageException { if (c.getAge() < 18) { throw new UnderageException(); } if (tattooSize.equals("small")) { int i=1; while (i <= 11) { if (appts.get(i).equals("")) { appts.set(i, c.getName()); return i; } i++; } throw new AllBookedException(); } else { int i=1; while (i <= 10) { if (appts.get(i).equals("") && appts.get(i+1).equals("")) { appts.set(i, c.getName()); appts.set(i+1, c.getName()); return i; } i++; } throw new AllBookedException(); } } void cancelAppointment(Customer c) { for (int i=1; i<12; i++) { if (this.appts.get(i).equals(c.getName())) { this.appts.set(i,""); } } } public String toString() { String retval = ""; retval += "Schedule for " + this.name + ":\n"; for (int i=1; i<=11; i++) { if (!this.appts.get(i).equals("")) { retval += i + "pm: " + this.appts.get(i) + "\n"; } } return retval; } }