A stack is a simple data structure that enforces a LIFO (last-in,
first-out) policy to manage its data elements. In this lab, you will
Array class from the previous lab to implement a
Stack class. Specifically, you will implement a bounded
Stack class, whose maximum size is fixed at the time of
Stacktemplate class (Stack.h) that is part of the distribution for this lab. Do not vary from this specification.
Given a specification for a Stack class, write the methods and
operators for that class. The class represents an ADT with operations
is_full. Use your Array class
for the implementation, which should make the Stack implementation
A test driver program is supplied (main.cc) but
you must extend it to completely test your
implementation. Your implementation must check for error conditions,
such as attempting to pop off an empty stack or push on to a full
stack, and failing to allocate dynamic memory. And be sure to
test all of the methods, including
Be sure that
check whether the stack is empty or full, as appropriate. They return
0 for success, or -1 if the stack was already full when attempting to
push, or empty when attempting to
~cs342/bin/lab3. That will copy several files to a new
lab3subdirectory. You can
cd lab3and enter
maketo compile the code, if you like. However, it will not link until your implementation is filled in.
NOTE: you can use the distribution mechanism to
revert one or more of your files at any time. First, delete the file
mv it to a file with a different name, such
Stack.cc.BAD). Then, run
cvs update to
update your workspace. That will replace any missing files. It will
also let you know of any files that you modified but did not delete.
cvs is in pkg
gnu, in case you don't find it
After obtaining the Lab 3 distribution, copy your
Array.cc files from your Lab 2 to your
directory. You should use those files without modification. However,
you may fix bugs in your Array implementation.
Stack.cc file is included. Fill
in this file, and add any necessary code to the private section of
Stack.h to complete the assignment.
readme) documenting what you did to satisfy this assignment.
readmecontains a suggested list of sections that you might provide. Please replace the comments in  with your descriptions. Specifically mention what the most troublesome parts were. These files will be submitted automatically when you execute the command:
NOTE: there is a Makefile target that allows you to test what you are going to turn in:
It places the output that will be
turned in into the
TEST_TURNIN directory. Please use
make test_turnin, and verify that the files that you will
submit are correct.