Menu

[Solved] Pa 2 Postfix Evaluation Tool Please Write Java Program Convert Fully Parenthesized Infix E Q37269949

PA 2 – Postfix EvaluationTool

Please write a Java program to convert a fully-parenthesizedinfix expression into itsequivalentpostfix  expression, and thenevaluate the postfix expression with the final result shown to theuser. You may use a stack during the conversionand evaluation process. You must NOT use any existing Java classessuch as ArrayList or Vector. Please stop your program if the userenters 0 as the input expression.

You must run three different test cases tofully test your program. Each test case must accept at least 3fully-parenthesized infix expressions. Your Test Case#1 must look as follows:

Test Case 1: (Red text isinput from the user, while black text is output from yourprogram.)

Welcome to the Postfix Expression Tool of Dr. SimonLin!

Please enter a fully-parenthesized infix expression:

( 8 * ( 10 – 7 ) )   

Postfix expression:      810 7 – *

Final Result: 24

Please enter a fully-parenthesized infix expression:

( ( 8 * ( 10 – 7 ) ) / ( 4 + 2 ) )

Postfix expression:      810 7 – * 4 2 + /

Final Result: 4

Please enter a fully-parenthesized infix expression:

(   ( ( 8 * ( 10 – 7 ) ) / ( 4 + 2 ) ) * ( 9 /3 )   )

Postfix expression:      810 7 – * 4 2 + /   9    3 /  *

Final Result: 12

Please enter a fully-parenthesized infix expression:

0

Thank you for using this Postfix Evaluation Tool of Dr.Simon Lin!

Expert Answer


Answer to PA 2 – Postfix Evaluation Tool Please write a Java program to convert a fully-parenthesized infix expression into its … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *