Question: Write a simple calculator parser in java. Don't make this complicated. You will have input of the form: number (operator number) (operator number) (operator number)...
Write a simple "calculator" parser in java. Don't make this complicated. You will have input of the form:
number (operator number) (operator number) (operator number)...
where a number is just a string of digits (don't worry about signs, floating point numbers, scientific notation...)
and operator is one of +,-,*,/
Find each of the above tokens and identify it as a number or operator
For example, the input:
5 + 3 * 2
should output:
5 number
+ operator
3 number
* operator
2 number
You may assume that each token has at least one space between it and the next token
If you hit an error character you can either ignore it or terminate your program
Hand in your java source code.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
