Please don't answer if you cannot complete all the requirements. This question has been answered but it was incorrect!!!
You are to write the following PersonalCalendar, Event and Appointment classes and other interfaces or classes as necessary. Note that there is no main method required in this assignment; a JUnit test will be used instead.
Some details of the implementation are left to you. Other details are implied, but not stated directly, in the description. (That said, don't over think this; do the minimum required to perform the specified function.)
You are to write a class PersonalCalendar. Entries in a PersonalCalendar can be either an Event or an Appointment. Entries can be added to, returned from and removed from the PersonalCalendar.
An Event has a date consisting of ints for year, month, dayOfMonth, hour and minute. It also has a String description, a String location and an int duration in minutes. Events do not have attendees. Two Event objects are equal if their dates and descriptions are equal.
An Appointment has a date consisting of ints for year, month, dayOfMonth, hour and minute. It has an int duration in minutes and a String description.
An Appointment also has an ArrayList of Strings for attendees. Attendees can be added to an Appointment. An Appointment does not have a location--that's assumed to be my office. Appointment has an equals method that compares dates and descriptions to determine equality.
A PersonalCalendar maintains its entries sorted by date, not the order the entries were inserted. Thus the first element of a PersonalCalendar is always the fist element chronologically, regardless of the order the elements were added. If two elements have exactly the same date and time, description is used to break the tie. (Hint: GregorianCalendar and Collections.sort. Also let your IDE help you write commonly used code.)
You are to write a JUnit test to verify that a PersonalCalendar object maintains its entries in the correct order.
Here are some bullets I will use in grading
PersonalCalendar accepts both Event and Appointment objects
PersonalCalendar does not accept objects such as String
PersonalCalendar keeps its content sorted appropriately
Event implements the specified function
Appointment implements the specified function
JUnit tests verify the following:
A PersonalCalendar with a single Appointment or Event contains the expected object.
A PersonalCalendar returns its objects sorted first by date and then description, regardless of the order the objects were added, and regardless of whether the items were all Events, or all Appointments, or a mixture.
My JUnit test class was long, but that was mostly because I did a lot of copy/paste for test setup. None my other components were more than 50 lines of code.