Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

Students also viewed these Databases questions