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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!