CS 153 Data Structures I
Programming Assignment #9
Due: 10/18/01
This programming assignment is designed to:
- Review and extend your understanding of inheritance
- Introduce/practice postfix evaluation using a STACK
- Introduce private Inheritance
Before beginning work you will need to add one member function to the class
List (assignment #8). The prototype for it is Node * GetHead(); The body for
it is the one line return(mHead);
Possible confusion: You will be using inheritance in two different situations
- You will inherit a data object (strData) from Node just like in project
8
- You will inherit from class List to create a new class Stack
Overview: This project will
- accept a postfix expression in an CString EditBox
- evaluate the integer numeric expression (using an integer stack). The pseudocode
for evaluate postfix is in your text (Fig. 7.10). When the text refers to
'reading', your program will get the next token from the CString EditBox.
- display the integer answer in an int EditBox
- The GUI should contain:
- CString EditBox for a postfix expression
- int EditBox for the answer
- a button labeled EVALUATE
NOTE ON THE USE OF PREVIOUS FILES - You should start a new project because
it will be easier to design a new GUI than to revise the previous one. You will
however be making extensive use of the List class. Following the following steps
for getting started:
- Create a new project 9
- Copy/Paste the List .h and .cpp files from the project 8 directory to the
project 9 directory
- 'Tell' project 9 to include the copied files into this project
- If struct/class Node and struct/strData were in separate files repeat #s
2 and 3 for those files
- class strData - create or modify from #8.
- strData needs to public inherit from Node.
- it should contain only one data item, an integer named mData
- class Stack -
- create in its own .h and .cpp file
- inherit private from class List
- define public function members
- void Push(Node *);
- Node * Pop();
- Node * Top();
- make public the following inherited member functions
- isEmpty
- isFull // if you still have one. If not that's also OK