15-100 Exam #1, Question #1 (Afternoon Edition)
Please implement a class, ConferenceRoomList, that functions as a
list, indexed by roomNumber, of Reservations associated with
individual conference rooms. You are provided with the
Reservation class, which describes simply
objects composed of only a contactPerson and the
numberOfPeople attending the event.
The ConferenceRoomList class should have the following properties:
- It should model a fixed number of conference roomss, numbered 0
through some maximum numberOfRooms. This size should
be fixed when the ConferenceRoomList is initialized.
- It should be possible to makeAReservation. This
associates a Reservation object with a particular
roomNumber. Conference Rooms are numbered 0 through
numberOfRooms-1. Making a Reservation for a
room should destroy any prior association between a
Reservation and the same room, if any.
- It should be possible to getAListOfAllContacts. In other
words, a ConferenceRoomList, should be able to return
(not print) a nicely formatted list of all people
listed as contactPerson for a room Reservation.
It is possible, of course, that the user will enter an
InvalidRoomNumber. Should this occur, the affected method should
return nothing. It should instead handle it using the typical Java mechanism
for informing the user of the problem. You are not responsible for other