CS 112
Homework 8
Due: Wednesday April 10, 2001
by 12:00 a.m.
Implementing a List Class
- Before starting working on this homework, and for
practicind the
ideas discussed in class on Thursday, look at an old
exam. Do problems 3, 5 and 6 from the
exam. Be ready
to ask me questions on Tuesday. This will help you understand
the material and the assignment.
- The main task of this homework is to
implement a list abstract data type in C++. Similar to Hw5
(when you did the stack) and Hw7 (when you did a queue).
It should be a list of integers. The
class should be called IntList.
You will have to design a class
that closely implements the structure illustrated by the
list applet.
- Start with deciding what files you need and how they depend
on each other. Create the Makefile first, so that you can compile
and execute code even when it is just partially designed.
- Apply the software design and testing methodology that I have emphasized
throughout the semester:
- Start the design of the class on paper.
- Create the header file for the class, but implement only one
function at a time and test it thoroughly before moving on to the
next one.
- The testdriver should include options to allocate a new list dynamically,
on which you will test functions such as insert and delete. The
interaction with the user should be menu-driven. The menu
options should mirror the buttons of the list applet, with
options for creating a new list, inserting and deleting
elements, printing and navigating through the list.
- Start the delete functions for lists by making them just
remove a cell from the list. We will learn on Tuesday how to
deallocate the space (and you will have to add a few extra
lines of code to complete the homework).
To submit
Submit in Hw8 all the files that are necessary for
compiling, executing and proving the correctness of your code:
header and implementation files, testdriver, makefile and a
typescript, plus a data file with your test data.
See below for naming conventions.
Naming conventions and files to submit (in Hw8):
- List of integers: IntList.cpp, IntList.h
- Test driver: testList.cpp
- Makefile
- Data file: data
- typescript
Ileana Streinu