# stack program

*label*Computer Science

*timer*Asked: Nov 12th, 2016

**Question description**

This is a three part project:

- Implement the
*stack*interface that I have attached as both a dynamic size array and as a linked list. - Implement functions to convert one type of notation to any other type (eg infix to prefix).
- Implement an expression evaluation function.

You should write a driver program called 'XFixDriver.java' which prompts the user for the type of notation that he would like to enter, followed by the notation he would like to to convert to.

**Particulars**

**Possible Conversions**

There are six possible user requests:

- infix to postfix
- infix to prefix
- prefix to infix
- prefix to postfix
- postfix to infix
- postfix to prefix

**Note:** Implement all of these as separate functions. Don't use intermediate conversions.

**Variables**

All variables should be single chars A-Z or a-z. If anything else is processed, then the expression is illegal and you should report it as such.

**Operators**

The only operators that you should process: +,-,*,/,^

Any other operator found should cause an illegal expression to be reported.

**Parens and Brackets**

You are expected to process infix notations that have (),[],{} groupings. If you encounter any kind of missmatch, then you should report the illegal expression.

**Driver**

*What type of expression would you like to enter:*

*1) Infix*

*2) Postfix*

*3) Prefix*

*0) Quit*

*Enter expression:*

*What would you like to do:*

*1) Convert to infix*

*2) Convert to prefix*

*3) Convert to postfix*

*4) Evaluate Expression*

*5) Return to Main Menue*

*0**) Quit*

**Test Cases**

As with all our projects, you are expected to generate your own test cases. Think about all the possible edge cases. Consider mismatched parens or brackets, invalid operators and invalid variable names.