Question: PostfixTester: PostfixEvaluator: ArrayStack: Stack: Enhanced Postfix Evaluator 1. Problem Description In class, we went over postfix expressions and an approach for evaluating them using a


PostfixTester:

PostfixEvaluator:

ArrayStack:

Stack:

Enhanced Postfix Evaluator 1. Problem Description In class, we went over postfix expressions and an approach for evaluating them using a Stack. The Java code was likewise presented and is available in Canvas. You are to enhance this code and include the several additional operations listed below. Your Java program will continue to prompt the user for additional expressions until the user chooses to finish. Your solution should handle any exceptions gracefully and report the error. This program is to be done on your own, not part of a team. Add the following new binary operators: Modulus: el e2 % Power (e1 raised to the e2 power): e1 e2^ Example Expressions: 17 5 % (Result: 2) 34. ^ (Result: 81) Add the following new unary operators: Unary minus: e Factorial: e! Example Expressions: 12 ~ (Result: -12) 5 (Result: -5) 6 ! (Result: 720) 3! 4 * 53% - 4 2 - / * (Result: -44) Add the following relational, Boolean and ternary operators: Relational Operators: e1 e2>, e1 e2 (Result: 1) 53 23> | (Result: 1) 00 (Result: 0) 5 3 Result = 1 Post-fix expression: 53 Result = 0 Post-fix expression: 5 5 = Result = 1 Post-fix expression: 10 5 & Result = 1 Post-fix expression: 53 > 2 3 >| Result - 1 Post-fix expression: 1 Result = 0 Post-fix expression: 53 stack = new ArrayStack
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
