implement a calculator that would pars evaluate an arbitrary expression that may 1) Rational numbers (e.g., 4.5669
Question:
implement a calculator that would pars evaluate an arbitrary expression that may
1) Rational numbers (e.g., 4.5669 or -3.5);
2) Parentheses '(' and ')';
3) Operators "+", "-", "*", "/", and "^". The latter operator is that of exponentiation, which,
has the highest precedence.Your code must handle rational exponentsincluding the negative ones. programmust1use a recursive-descent technique, as explained in class, based on the following grammar for expressions, as discussed in class:
'+' '-'
'*''/' '('')''.' ' 0', '1', '2' ... '9'
program must correctly handle all error conditions (it must never crash!). You may use all Java mathematical libraries available to you.and program should recognize:'='and process it by printing the value of the identifier. For example, you could writex = 20, which will result in your program displaying 20. Once an identifier has been assigned a value, it can be used in subsequent expressions (e.g., x+3). A subsequent assignment can change the value of the identifier.
You should store all identifiers in a hash table.
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates