import java.util.Date;
import java.util.Vector;
/**
 * DayPlan models the behaviour of a single day's
 * plan or schedule.
 */
public class DayPlan {
  
  /**
   * this DayPlan's list of events
   */
  private Vector eventList= new Vector();
  
  /**
   * this DayPlan's Date
   */
  private Date date;
  
  /**
   * how many DayPlans are there?
   */
  private static int dayPlanCount;
  
  /**
   * create a DayPlan with Date d
   */
  public DayPlan(Date d) {
    date= d;
    dayPlanCount= dayPlanCount + 1;
  }
  
  /**
   * empty constructor
   */
  public DayPlan() {
    date= new Date();
    dayPlanCount= dayPlanCount + 1;
  }
    
  /**
   * set this DayPlan's Date.
   */
  public void setDate(Date d) {
    date= d;
  }
  
  /**
   * what is this DayPlan's Date
   */
  public Date getDate() {
    return date;
  }
  
  /**
   * add an event to this DayPlan
   */
  public void addEvent(String event) {
    eventList.add(event);
  }
  
  /**
   * remove event n from this DayPlan's events list
   */
  public void removeEvent(int n) {
    eventList.remove(n);
  }
  
  /**
   * return this DayPlan's events as a String
   */
  public String showEvents() {
    String eventString= "";
    for (int i= 0; i != eventList.size(); i++) {
      eventString += (String) eventList.elementAt(i) + "\n";
    }
    return eventString;
  }

   /**tell us how many events there are
   */
  public int getNumEvents() { 
    return eventList.size();
  }
  
  /**
   * report the number of DayPlans
   */
  public static int getDayPlanCount() {
    return dayPlanCount;
  }
  
  /**
   * represent this DayPlan as an
   * informative String.
   */
  public String toString() {
    String result= "Date:\n";
    result= result + date.toString();
    result= result + "\nEvents:\n";
    result= result + showEvents();
    result= result + "\nNumber of events:\n";
    result= result + getNumEvents();
    return result;
  }
  
}