QuestionAsk Questions?

APL is a programming language in which arithmetic/mathematical expressions

are evaluated right to left

For example:

1+2*3 = 7 but 2*3+1 =8

4-2-1 = 3 (same as 4 - (2-1))

Portion enclosed in braces evaluated first as in (2*3)+1 which is 7.

Write a program in Java to evaluate APL expressions.

(Hint the expression is read as a string of characters and

pushed onto a stack and then pop operand2 and operator and operand1

then apply the operator to operand1 and operand2.

View Answers

Related Tutorials/Questions & Answers: