/* * @topic T11339 Spring 2017 Inheritance Demo * @brief class TimeTable */ package inheritancedemo; import java.util.ArrayList; import inheritancedemo.TimeSlotType.*; public class TimeTable { //-------------------------------------- // data attributes //-------------------------------------- private ArrayList<TimeSlot> timeTable = new ArrayList<TimeSlot>(); //-------------------------------------- // operations //-------------------------------------- public void addEntry( TimeSlotType type, int employeeID, int units ) { switch ( type ) { case WEEKEND: timeTable.add( new TimeSlotWeekend( employeeID, units ) ); return; case WEEKDAY: timeTable.add( new TimeSlotWeekday( employeeID, units ) ); return; default: // TODO throw an exception... }//addEntry } public ArrayList<TimeSlot> getTimeTable() { return timeTable; }//getTimeTable }//class TimeTable