15-100 Exam #1, Question #1 (Morning Edition)

Please implement a class, ApartmentDirectory, to model a list, indexed by apartmentNumber, of Familys living within an apartment building. You are provided with the Family class specification which describes simply objects composed of only a familyName and a size of the family.

The ApartmentDirectory class should have the following properties:

Two different types of errors might occur during the execution of ApartmentDirectory methods. In the interest of time, you must handle only one of these two types of errors - your pick. You can assume that the user will be well behaved and not generate the other. You should use the typical Java mechanism to ensure that if the error condition occurs, the affected method does not return normally, but instead inform the caller of the condition.