Question: How to make a java code that uses the prefixEvaluation class for the + - / * operators in which the output will look like
How to make a java code that uses the prefixEvaluation class for the + - / * operators in which the output will look like this
Enter an expression: 3
Evaluates to 3
Enter an expression: ( + 1 2 )
Evaluates to 3
Enter an expression: ( / 16 3 )
Evaluates to 5
Enter an expression: ( -10 1 2 3 )
Evaluates to 4
Enter an expression: ( / 120 2 3 4 )
Evaluates to 5Enter an expression: ( + 1 ( -12 10 ) 3 ( / 20 5 ) 5 ( * 2 3 ) )
Evaluates to 21Enter an expression: ( + ( -( * ( / 12 4 ) 2 ) ( + 3 7 ) ) 10 )
Evaluates to 6
Enter an expression: Done
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
