CS3350-Postfix-Expression-Evaluator

Requirement

In this request, you will create and turn in your second program on BGUnix. Please see the documentation below for instructions on obtaining and configuring a BGUnix account.

Once you have an account, SSH in and join the class by issuing the command:

1
$ class -join cs3350

This should create a directory in your home directory named ‘cs3350’. All your work this semester must occur inside this directory (do not create a subdirectory unless the request specifically requests one). Any required files will be automatically collected from this directory at the due date/time for the request!

Program Details

In this program, you will implement a postfix expression evaluator. See the book and slides for the concrete algorithm you need to implement. You must use stacks (I provide LinkedStack.h/LinkedStack.cpp/StackInterface.h/Node.h/Node.cpp files in the class lib folder!).

You must provide a hw3.cpp driver file that contains the implementation of the algorithm and a main method that instantiates runs the algorithm. The driver program should:

  • Loops, asking the user to provide either a number (can be more than 1 digit!) or an operator (+ - / *)
  • Stops the loop when -1 is entered (do not add -1 to the expression!)
  • Evaluates the given postfix expression
  • Displays the final result of evaluating the postfix expression (on a line by itself - this should be the last line displayed by your program!)

Documentation

Your code should include proper documentation/comments where appropriate. A portion of the grade is attributed directly to documentation (see the grading rubric provided on Canvas).

Functions should be proceeded by a comment block documenting the function’s purpose.

Blocks of code should contain comments describing what that block is contributing to the overall solution.

What to Turn In

The automated turn-in collection script will save these files from your class directory:

  • hw3.cpp

The script will assume the following command line to compile your request (your code must work with this exact command line!):

1
$ g++ -std=c++11 -Ilib hw3.cpp

This assumes that LinkedStack./StackInterface.h/Node. are in the lib/ directory.