CS 200, Spring 2015
P1: Evaluating postfix expressions using a stack

Due and late dates and times

Overview

The object of this assignment is to exercise postfix expressions, scan them in, and evaluate then using a stack. Copy the following client code, starter Postfix code and input file:

EvalPost

This client code is provided and exercises your Postfix code. Don't change it. We will use other client codes in the testServer.

Evalpost gets the input filename from agrs[0]. If a second argument exists, debug is true, else false. EvalPost creates a scanner that reads lines from the file named in args[0] and instantiates a Postfix object for each line. It then calls the eval method in the Postfix object, and prints the result returned.

Postfix

This is the code you need to work on. The instance variables are: Implement evalStack, a stack of Integers, with the methods push and pop. In the method eval, use pops and pushes to evaluate the postfix expression. You need to at least implement the following methods (you may want to create helper methods):

Testing and submitting your code

Use the Checkin webserver to exercise and submit your code. Submit your Postfix.java file.