CS-240
Data Structures
Project 2

Objectives: Upon completion of this project the student shall be:

1. Familiarized with the dynamic implementation of Lists, Stacks and Queue Abstract Data Types and the concepts of Inheritance and templating.

2. Able to determine which data structure is appropriate to use depending on the application.

Definition:Develop classes for representing classes for the List, Stack and Queue Abstract Data Types. The List class should be for both ordered and unordered lists. List should be a base class. The Stack and Queue classes should both be derived from the List class using public inheritance. To make the implementations as useful as possible they should be implemented as templates so that the containers being created can hold any element type.

Design, develop and implement a software system that will allow a user to input a source level program into a file created by the user using their favorite ASCII text editor and submit that program to the project program for execution.

  1. Read each statement of the source level program into a queue of text strings
  2. Remove each statement from the queue (in turn) and do the following"
    1. Using a stack convert from infix format to postfix format; leaving the postfix string in a text string.
    2. Take the postfix string and , using another stack, evaluate it and place the result in an ordered linked list (keyed by variable name).
  3. Repeat the above for each statement in the input queue until the queue is empty. When empty, traverse the variable list and print each variable and its current value.

Hint: The project will require the following data structures:

Example: Input file A=5 B=10 C=A+B D=C*C Result: A=5 B=10 C=15 D=225

Input Queue and Variable List Data Structures

Infix to Postfix Conversion Example