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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started