This homework is necessary preparation for the lab. Make sure you type your answers and you bring the files to the lab so that you will not have to waste time entering them during the lab.
- For this homework, you will design the interfaces for a new
component family, WaitingLine. WaitingLine is
trying to capture the idea of a waiting line like you might
encounter at a restaurant. Customers upon arriving at the
restaurant have their name added to the end of the waiting line;
they can ask for their position in the waiting line and perhaps
later decide to leave and ask to be removed from the waiting line.
Customers are seated in the order in which they are added to the
waiting line. Note that a restaurant is just one example of where
such a waiting line may be useful. There are many other situations
where waiting lines occur and your components should be applicable to
such other situations as well. WaitingLine is similar to
Queue in that it provides a FIFO (first-in-first-out) order
of processing, but differs from Queue in the following
significant ways:
- The entries in a WaitingLine must be unique.
- It must be possible to remove a given entry known to be in a WaitingLine.
- It must be possible to find the position of a given entry in a WaitingLine.