20-CS-122-001 Computer Science II Spring 2012
Evaluate an Arithmetic Expression

Virtual functions, classes, inheritance, lists, queues, stacks, applications

Evaluate Simple Arithmetic Expressions

Instructions: Type the expression into the large text area. Known operators are +, -, *, /, ^. The stacks on the left change with every keystroke. Backspace to undo. The stacks follow the undo. Use the "Clear" button to start over. The "Messages" textfield indicates Parse errors.

Important: In this applet all operators are given equal precedence and association is from left to right. Thus, 3+4*5 evaluates to 35. This is done to keep the homework simple - we are not studying arithmetic expressions now, only how stacks may come in handy in some real application.