I am asked to write a program in java that gets a line from the user (string) with real numbers (double) and arithmetic operations and (it might contain spaces) calculates the sum.
please enter your expression:
10.22 -2.22 +3.0
10.22 -2.22 +3.0=11.0
well, i thought about using split() with a regular expression but I don't find a suitable one.
would you help me please?
You have to tokenize the input and then evaluate it.
For tokenization you can look at one of the following
Presuming of course that part of your homework is not writing a regex.