0
string 1+2^3
in java, I want to get a string from the user and calculate string and show the result without Stack.(ex : 1+2*3 get from user and calculate with java program and print answer: 9) How can I do it?
4 Answers
0
First of all string is a text. You cannot use text to calculate. What you probably ask here is how to get input from user as a bunch of variables and use those in formula.
To get input you can use Scanner for example. For mathematics use Math.
You can easily google those or find them in Java documents
0
I know how to use scanner and math class.
I want to do this for example:
1+2+3-4*5*.......
0
find the answer
https://code.sololearn.com/c70tDc4cf312/#java
0
As others say: get input from user, explode string and do the math. That's all.
Order of operations will be tricky.