Question: Kindly share your solution in a presentable manner and also screenshot of output Please its my project its my posting 3rd time i need presentation

Kindly share your solution in a presentable manner and also screenshot of output

Please its my project its my posting 3rd time i need presentation mode with screenshot dont copy paste

CSS 342 extra coding.

This is a three part project:

Part one build a program that:

Prompts the user for a string of user input .

Treat that string as a mathematical expression in an infix form.

Convert the string into a series of tokens where each token is an operator, or a value delimited by whitespace , operator, or

Part two

Convert to postfix and print out the results. ( or print out an error if badly formed)

Part Three further.

Do the math to evaluate the expression when all operands are values ( not variables)

Each part will add up to 10 points to your coding grade in class.

For this project the operators you will support are:

Plus +

Minus

Times *

Divide /

Modula %

When I test the program I would expect to see something like this: ( Bold is what I enter on the command line)

Input an expression: A+ B * 31

Tokens: A + B * 31

Postfix: A B + 31 *

Value: Cannot be calculated

Input and Expression: 3+4*12

Tokens: 3 + 4 * 12

Postfix: 3 4 12* +

Value: 51

If the input expression is invalid, print out that fact. Use exceptions to catch any error conditions.

(Note put a space between each Token for clarity)

A few things that we have not talked about ( or talked about in class today)

How do you look at a string and know what the operands vs operators. IE if the input string is:

A+FRED+23*13-GG OR A + FRED +23* -GG

How do you identify that the tokens are A, FRED, 23, * etc. and which tokens are operands vs operators?

The easiest way is with a stack.

Put the first character on the stack.

Keep putting characters on until you see an unpend char ( a space) OR an operator or a

Pop the chars off the first stack onto a second

Pop the chars off the second stack ( now they are in proper order)

Pass the token to your infx to postgix code.

If you have an operator. Send that

Repeat until no more characters.

50% of grade will be does it work with simple test case

30% of grade. Does it work in all test cases

10% Format. Indentation readability

10% comments.

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!