School of Engineering and Applied Science
Department of Computer Science
CSci 133 -- Algorithms and Data Structures I
http://www.seas.gwu.edu/~csci133/fall04
Prof. Michael B. Feldman
mfeldman@gwu.edu

Project #4

Due Dates: Phase 1: beginning of class, Tuesday, November 9, 2004
complete project: beginning of class, Tuesday, November 16, 2004

The objective in this project is to develop a translator that converts an infix arithmetic expression into a postfix (RPN) expression. This project depends on material from Lewis & Chase, Chapter 6, as well as the handout Translating Arithmetic Expressions to  Postfix ("Reverse Polish" or RPN) Form.

The textbook provides a class PostfixEvaluator, which contains some constants and methods, and an application Postfix, which reads RPN expressions from the keyboard and evaluates them. The handout provides an algorithm for translating an infix expression into an RPN expression.

Phase 1:

  1. Modify the class so that it uses your linked stack instead of an array stack; retest the class using the Postfix application
  2. Add a stub for a new method String toPostfix(String infix) which takes an infix expression as input and returns a postfix expression
  3. Document the revised PostfixEvaluator class using javadoc

Phase 2:

  1. Implement the toRPN method using the final algorithm, with precedences and parentheses
  2. Modify the Postfix application so that instead of reading a postfix expression, it