CS 112
Homework 5
Due on Monday, Oct. 16, 2000, by 12:00
a.m. (midnight)
To do:
-
Part 1
Implement the stack abstract data type in C++ following the
model shown in class. Provide a simple menu-based
test driver for it. You can start by copying
the templates I made available
here, or copy them
directly from the handout directory in the class account.
-
Part 2
Then perform the following simple modifications: implement an abstract
data type for a stack of characters (not integers).
Name your class CharStack and the testdriver testCharStack.
Design a test driver for it, too. (You can do it
by performing simple modifications on the
test driver for stacks of integers.)
-
Part 3
The same, for a stack of CustRec records (the same data structure
we used to illustrate templates in C++).
- Part 4 (Extra credit):
Design a testdriver to test all the three stacks
above. You should be careful with the makefile, which will
contain 4 different compilations (three for the three classes,
one for the main program).
See instructions below on how to name the files for this
homework, and how to submit.
- Naming the files: the class file and header file
should have the same name as the class they contain. The 3 stacks
should be named IntStack, CharStack and
CustStack.
The testdrivers should be named respectively testIntStack,
testCharStack and testCustStack, and
testStack for the extra credit part. The makefile
should be Makefile and the usual typescript
submitted with them.
- Submitting
For this homework, submit all the files for Part 1 using:
submit Hw5A
For Part 2, do:
submit Hw5B
For Part 3,
submit Hw5C
For Part 4,
submit Hw5D
Files to submit (for all C++ homeworks)
Header file, all cpp files (class and testdriver), the
Makefile and a typescript.
In other words, everything that is needed to recompile you
program (source code and Makefile), and a proof that it really
works (typescript).
Last modified Oct. 4, 2000.
Ileana Streinu