Question: Learning Activity-02: Converting mathematical expressions from Infix to Postfix Convert infix expressions to postfix expressions Assume: expressions consists of only spaces (a single space in

Learning Activity-02:

Converting mathematical expressions from Infix to Postfix

Convert infix expressions to postfix expressions

Assume:

expressions consists of only spaces (a single space in between two elements), operands (can be single character/digit or multi-character/ multi-digit), and operators (consider only +, -, *, /, %).

space is a delimiter character (you may use string split method assuming this delimiter character)

all operands that are identifiers begin with a letter or underscore

all operands that are numbers begin with a digit

You may use the algorithm in this document and the starter code provided in the d2l course webpage.

What you need to do:

Implement the InfixToPostfix class in the way you want however, you must have a method with the Signature: public String getInfixToPostfix(String infix).

The above method should return the postfix string equivalent to the given input string infix.

You may or may not modify the main method.

Your InfixToPostfix class must pass the provided test cases.

You must not modify the test class!

Marking Criteria

Name

Description

Max Points

Functionality

The method gives postfix expression correctly. The method works for all test case inputs.

60%

Efficient implementation

Algorithmic steps are followed efficiently.

20%

Readability and comments

Your program is easy to read/understand. It has frequent comments for explaining complex statements/ methods/ important sections.

20%

Total

100%

Example:

convert

w 5.1 / sum * 2

to its postfix form

w 5.1 sum / 2 * -

Visual Algorithm with Steps:

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!