Question
[JAVA] I am writing code to create a calculator program in Java using stacks with infix and postfix notation (Shunting Yard Algorithm). I have gotten
[JAVA]
I am writing code to create a calculator program in Java using stacks with infix and postfix notation (Shunting Yard Algorithm). I have gotten my code to convert infix to postfix successfully. While evaluating the postfix expression, my professor has the comment:
// 2. When you see an operator, pop the first operand off the stack
// and place to the right of the operator. Pop the next operand
// off the stack and place to the left of the operator.
What does that mean?? I don't understand what is meant by "When you see" and "place to the right." Additionally, we have another class with methods that are meant to help with our development. It's a parse class that includes evaluating precendence and indiciating if a token is an operator (returns a boolean value).
Please help; thank you!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started