question archive You must define and implement your own Stack class
Subject:Computer SciencePrice: Bought3
You must define and implement your own Stack class. The Stackclass supports standard basic stack operations, (like pop(), push()) and you can implement it with an array. You should create a class template-->generic class Stack in Java, but an integer stack would work as well. Set up a function or static method that receives a string representing a postfix expression and it returns an integer result. Your function/method uses a stack to evaluate a postfix expression (see an operand --push; see an operator -pop twice, evaluate, then push result).
Test your function/method and Stack class with the following postfix expressions by using a test driver:
17 2 3 + / 13 -
5 2 3 ^ *
2 3 2 ^ ^
Answers for the postfix expressions above:
-10
40
512