The case study "SortWithPointers" illustrates a natural requirement for the manipulation of dynamic data using operations such as were introduced in the implementation of the Date datatype. A collection of elaborate personnel records is organized by means of a list of pointers to those records. The records are kept in order by sorting this list of pointers. The sort is very efficient because only the pointers have to be moved, not the bulky records.
Finally, the case study "DynamicArrays" illustrates how C++'s ability to manipulate dynamic data allows for the construction of a DynArray class which extends considerably the language's built-in arrays. These new dynamic integer arrays can have their size specified at runtime, will automatically check that array indices are within bounds, and will support aggregate array copying and aggregate array initialization.
// SPECIFICATION FILE (date.h)
// This file gives the specification of a Date abstract data
// type representing a date and an associated message
// IMPLEMENTATION FILE (date.cpp)
// This file implements the Date class member functions
// SPECIFICATION FILE (reclist.h)
// This file gives the specification of RecordList, an ADT for a
// list of personnel records.
// IMPLEMENTATION FILE (reclist.cpp)
// This file implements the RecordList class member functions.
// List representation: an array of pointers to PersonnelData
// structs and an integer variable giving the current length
// of the list
// SortWithPointers program (sortWithPointers.cpp)
// This program reads personnel records from a data file,
// sorts the records alphabetically by last name,
// and writes them to the standard output device
// Assumption: The input file contains at most 1000 records
// SPECIFICATION FILE (dynarray.h)
// This file gives the specification of an integer array class
// that allows:
// 1. Run-time specification of array size
// 2. Trapping of invalid array indices
// 3. Aggregate copying of one array to another
// 4. Aggregate array initialization (for parameter passage by
// value, function value return, and initialization in a
// IMPLEMENTATION FILE (dynarray.cpp)
// This file implements the DynArray class member functions
// TestDynArray program (testDynArray.cpp)
// This is a very simple client of the DynArray class
17.1 (creating pointers to char, long, and struct)
17.2 (manipulating pointers to char, long, and struct)
17.8 (dynamic lists)
Now that we've got videos, we can concentrate on the video store. The first segment of this project modeled the videos themselves, and inventories of videos. This final programming project will create the software resources necessary to manage the video store. It will model the customers and the operations of the store.
We will take as our specification of the problem to be solved, our text's Programming
Problems 14.3 and 14.4, page 864 (video store). As for previous programming projects, this one asks for two components: (1) a design of your algorithms to solve the problem, such as our authors have been systematically constructing for their case studies, and (2) a complete and correct implementation of your algorithms in C++. The algorithm design consists of two parts: (1.a) a hierarchical chart showing the structure of the computation, and (1.b) descriptions of the contents of the various modules appearing in your hierarchical chart. This project calls for a careful mix of strict dedication to the problem specification contained in the description of the programming problem, and a programmer's software design freedom of choices in setting up the abstract datatypes to support that project.
Place an electronic copy of your work into the CS157 drop box before class time,
9:30:00 AM, next Tuesday, 23 November 1999. Personalize the results of your efforts
by using the file-naming conventions explained in class. Hand in paper copies of your solutions
at the beginning of class, 9:30:00 AM, 23 November 1999. The grader will use the paper copies for recording any comments he may wish to make about your work. Enjoy!