CSci 131 -- Data Structures
Project #5
Due Date: November 23, 1999
The purpose of this project is to gain more experience with linked lists, and also to explore active-iteration techniques. You will extend your Project 4 table package, and modify the Vehicles user interface client.
Re-test using Vehicles. An important goal of this project is to show the advantage of having a general and well-thought-out interface to a package like this, so that it is possible to change implementations without causing any client code to be modified.
Part B:
(A) Make a minor modification to Vehicles and Vehicles.IO, such that the vehicle brand is an enumeration type instead of a string.
TYPE Brands IS (Ford, Toyota, Volvo, Honda, Kia, Yamaha);Re-test with your Project 4 vehicles user interface.
(B) Add LAVS (list-of-available-space) storage management (Section 9.2) to the linked-list tables package. Modify InitializeTable, Insert and Delete accordingly.
(C) Add active-iterator functionality (Section 9.6) to the linked-list table package.
PACKAGE Tables_Generic.Iteration IS PROCEDURE StartTraversal (T: IN OUT TableType); FUNCTION RetrieveCurrentElement (T: TableType) RETURN Element; FUNCTION MoreElements (T: TableType) RETURN Boolean; PROCEDURE MoveToNextElement (T: IN OUT TableType); PROCEDURE StopTraversal (T: IN OUT TableType); END Tables_Generic.Iteration;(D) Add a new command to the user interface.
Please enter a brand name > Honda
The number of vehicles of this brand are: 5