Before writing the SchoolDirectory class, we must decide how to store entries. One approach is to create an array of some size maxSize and maintain a separate variable currentSize . We can keep adding entries to the array until currentSize equals maxSize . Such an approach does not place an arbitrary limit on the directory size, but also does not waste space excessively. With this approach to array expansion, we can insert new elements in name order, following the insertion process from an insertion sort.
Printing can follow a linear scan of the array, and data retrieval can follow from a binary search.
For data retrieval, however, we still must decide what the search should return. A common approach would yield the entry in question, so the program could do subsequent processing if desired. All of this work follows algorithms and approachs seen previously in the course, and we can present a first version of program SchoolDirectory.java . In particular, the parameter person for add must be an Entry . Through inheritance, every Student and Faculty object is just a special case of an Entry object, so this requirement holds.