0
JAVA CALCULATOR
Can someone tell me on how to make A java basic calculator that can do MDAS rule? that can input 4+3/7*2-14 Without using any advanced variables/datatypes like math and stuff. Only with the use of if else statements, double and scanner. Thanks!
5 odpowiedzi
0
https://code.sololearn.com/cwNdNCXA3kte/?ref=app
It's code of mine if u wanna take a look it's pretty messy
0
Lets check mine. The code is compact but very powerfull.
Supported operations are + - * / %, bitwise & ^ |, power #.
Parathneses are supported. Operations priority are supported.
Input like: -5*3 + 2#4/(3+2*-3+2*(2+4))
https://code.sololearn.com/cicAa55y1lSw/?ref=app
0
the Power Calculator can manage the expressions like 3 * -(2+1) with result of -9. And the previous one can’t
0
Jegors Čemisovs 2^(3*2) = 4 is false check this out
0
You are right. I’ve use ^ as original Java bitwise operator and this is confusing. You thinking that this is a 2 power 6 but this is 2 xor 6 and 2 xor 6 == 4