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!

10th Oct 2019, 2:45 AM
Rikazo
Rikazo - avatar
5 Respostas
0
https://code.sololearn.com/cwNdNCXA3kte/?ref=app It's code of mine if u wanna take a look it's pretty messy
10th Oct 2019, 3:14 AM
Eliya Ben Baruch
Eliya Ben Baruch - avatar
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
28th Feb 2020, 9:21 PM
Jegors Čemisovs
Jegors Čemisovs - avatar
0
the Power Calculator can manage the expressions like 3 * -(2+1) with result of -9. And the previous one can’t
28th Feb 2020, 9:26 PM
Jegors Čemisovs
Jegors Čemisovs - avatar
0
Jegors Čemisovs 2^(3*2) = 4 is false check this out
29th Feb 2020, 8:25 PM
Eliya Ben Baruch
Eliya Ben Baruch - avatar
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
29th Feb 2020, 8:29 PM
Jegors Čemisovs
Jegors Čemisovs - avatar