How to code a calculator that can evaluate equations like this "2+2*4/2"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to code a calculator that can evaluate equations like this "2+2*4/2"?

beginner question, the calculator i already made can only compute having on3 operation only. Is there any code that can evaluate them all?

7th Feb 2018, 7:35 AM
Cheesy Beer
Cheesy Beer - avatar
4 Answers
- 1
Hey It should be easy with Math Js library. Check it out
8th Feb 2018, 4:42 AM
Nick Nderitu
Nick Nderitu - avatar
8th Feb 2018, 4:44 AM
Nick Nderitu
Nick Nderitu - avatar
- 1
Also saw you are using Java. You can use ScriptEngine class.
8th Feb 2018, 4:54 AM
Nick Nderitu
Nick Nderitu - avatar
- 1
This code works well on Eclipse or NetBeans but for some reason it won't work on Solo learn Servers. https://code.sololearn.com/c7tSDCmXSJA5/?ref=app
8th Feb 2018, 5:26 AM
Nick Nderitu
Nick Nderitu - avatar