package edu.pdx.cs410J.chances;

import edu.pdx.cs410J.AbstractAppointment;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Appointment extends AbstractAppointment implements Comparable<Appointment> {
  public static final SimpleDateFormat DATE_FORMAT =
          new SimpleDateFormat("MM/dd/yyyy kk:mm");

  private Date beginTime;
  private Date endTime;
  private String description;

  /**
   * Construct a new appointment given a description.
   *
   * @param description Description of the new appointment
     */
  public Appointment(String description) {
    this.description = description;
  }

  /**
   * Get the time this appointment begins.
   */
  @Override
  public Date getBeginTime()
  {
    return beginTime;
  }

  /**
   * Set the time this appointment begins.
   */
  public void setBeginTime(Date beginTime) {
    this.beginTime = beginTime;
  }

  /**
   * Get the time this appointment ends.
   */
  @Override
  public Date getEndTime()
  {
    return endTime;
  }

  /**
   * Set the time this appointment ends.
   */
  public void setEndTime(Date endTime) {
    this.endTime = endTime;
  }

  /**
   * Get the time this appointment begins.
   *
   * @return String representation of appointment begin time
     */
  @Override
  public String getBeginTimeString() {
    return beginTime.toString();
  }

  /**
   * Get the time this appointment ends.
   *
   * @return String representation of appointment end time
   */
  @Override
  public String getEndTimeString() {
    return endTime.toString();
  }

  /**
   * Get the description of this appointment.
   *
   * @return Description of this appointment
   */
  @Override
  public String getDescription() {
    return description;
  }

  /**
   * Compares this appointment to another.
   *
   * Appointments should be sorted chronologically by their beginning time. If
   * two appointment begin at the same time, they should be sorted
   * chronologically by their ending time. Otherwise, the two appointments
   * should be sorted lexicographically by their descriptions.
   *
   * @param other Appointment to compare to
   * @return Ordinal difference between Appointments, zero if identical
     */
  @Override
  public int compareTo(Appointment other) {
    int difference = 0;

    // Compare begin times
    difference = this.beginTime.compareTo(other.beginTime);

    // Compare end times if begin times are identical
    difference = (difference == 0) ?
            this.endTime.compareTo(other.endTime) : difference;

    // Compare descriptions if begin and end times are identical
    difference = (difference == 0) ?
            this.description.compareTo(other.description) : difference;

    return difference;
  }
}

@@ -70,16 +70,45 @@
 tment;%0A%0A
+import java.text.DateFormat;%0A
 import j
@@ -352,16 +352,125 @@
 kk:mm%22);
+%0A  public static final DateFormat SHORT_DATE_FORMAT =%0A          DateFormat.getTimeInstance(DateFormat.SHORT);
 %0A%0A  priv
@@ -1461,27 +1461,42 @@
 urn 
-beginTime.toString(
+SHORT_DATE_FORMAT.format(beginTime
 );%0A 
@@ -1680,25 +1680,40 @@
 urn 
-endTime.toString(
+SHORT_DATE_FORMAT.format(endTime
 );%0A 

Use DateFormat.SHORT for time strings