To become familiar with how infix expressions can be


Objectives

To gain understanding of how an implementation of an ADT is used by an application program.
To learn how expressions can be evaluated at run-time.
To become familiar with how infix expressions can be converted to postfix expressions.

Task
Write a Java program (a collection of Java classes) including a class named ExpressionCalculator that contains a static main method. This main method will prompt the user to enter a constant expression (i.e., a mathematical expression without variables) at the keyboard. The expression must be in infix notation and must use spaces to separate the tokens (operands and operators) of the expression. (This restriction is imposed to simplify the parsing of the input.) The only exception to the space-separation rule is for the unary minus prefix operator, which will be assumed to be part of the specification of a negative constant operand. The program will then evaluate the expression and display the result on the console. It will then wait for another expression to be entered for evaluation, terminating on an empty input.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: To become familiar with how infix expressions can be
Reference No:- TGS0666829

Now Priced at $40 (50% Discount)

Recommended (97%)

Rated (4.9/5)