@@ -0,0 +1,2584 @@
+package edu.pdx.cs410J.chances;%0A%0Aimport edu.pdx.cs410J.AbstractAppointmentBook;%0Aimport edu.pdx.cs410J.AppointmentBookDumper;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.io.PrintWriter;%0Aimport java.util.concurrent.TimeUnit;%0A%0A/**%0A * @author chancesnow%0A */%0Apublic class PrettyPrinter implements AppointmentBookDumper%0A%7B%0A    File file;%0A%0A    /**%0A     * Construct a new pretty printer, printing to standard out%0A     */%0A    public PrettyPrinter()%0A    %7B%0A        this.file = null;%0A    %7D%0A%0A    /**%0A     * Construct a new pretty printer given the file path to print to%0A     *%0A     * @param filePath The file path%0A     */%0A    public PrettyPrinter(String filePath)%0A    %7B%0A        file = new File(filePath);%0A%0A        // Exceptional state when file is a directory%0A        if (file.isDirectory()) %7B%0A            file = null;%0A        %7D%0A    %7D%0A%0A    /**%0A     * Dump (overwrite) an appointment book to a file in a pretty format%0A     *%0A     * @param appointmentBook The appointment book to dump (write)%0A     * @throws IOException%0A     */%0A    @Override%0A    public void dump(AbstractAppointmentBook appointmentBook) throws IOException%0A    %7B%0A        PrintWriter pw;%0A%0A        if (file != null) %7B%0A            pw = new PrintWriter(file);%0A        %7D else %7B%0A            pw = new PrintWriter(System.out);%0A        %7D%0A%0A        pw.println(appointmentBook.getOwnerName() + %22's Appointment Book%5Cn%22);%0A%0A        int count = 0;%0A%0A        for (Appointment appointment :%0A                ((AppointmentBook) appointmentBook).getAppointments()) %7B%0A            if (count %3E 0) %7B%0A                pw.println(%22%5Cn----------------------------------------------%5Cn%22);%0A            %7D%0A%0A            pw.println(appointment.getDescription() + %22%5Cn%22);%0A%0A            pw.println(%22Beginning at: %22 +%0A                    Appointment.DATE_FORMAT.format(%0A                            appointment.getBeginTime()%0A                    )%0A            );%0A            pw.println(%22Ending at: %22 +%0A                    Appointment.DATE_FORMAT.format(%0A                            appointment.getEndTime()%0A                    ) + %22%5Cn%22%0A            );%0A%0A            // Calculate duration of appointment in minutes%0A            long difference = appointment.getEndTime().getTime() -%0A                    appointment.getBeginTime().getTime();%0A            long durationInMinutes =%0A                    TimeUnit.MILLISECONDS.toMinutes(difference);%0A%0A            pw.println(%22Duration: %22 + durationInMinutes + %22 minutes%22);%0A%0A            count += 1;%0A        %7D%0A%0A        // If printing to a file, close it%0A        if (file != null) %7B%0A            pw.close();%0A        %7D%0A    %7D%0A%7D%0A

Implement PrettyPrinter