0

Mathematics code Playground (Java)

I'm stuck in this one. First I had a problem with multiple operators that makes cases 3 and 4 fail. I think this is solved but case 4 still fails. I test my code with multiple operators and precedences but I don't found the problem. I'll apreciate some hint about case 4. My try: https://code.sololearn.com/czicvL8Iz0bj/#java

30th Jan 2020, 8:51 AM
Julio Codesal
Julio Codesal - avatar
5 Answers
+ 1
Julio Codesal check Dennis' reply from this thread. Looks you don't need to worry about operator precedence. https://www.sololearn.com/Discuss/2142606/?ref=app
30th Jan 2020, 11:32 AM
Mihai Apostol
Mihai Apostol - avatar
+ 1
Thanks Mihai Apostol With this in mind, I made a simple code that passed the test. But I still wonder why my first code did not pass test 4.
30th Jan 2020, 1:22 PM
Julio Codesal
Julio Codesal - avatar
0
I whant to operate first with "/" and "*". Then I loop trought the array and perfom the operation with the numbers both sides of the operator. I also replace this numbers with the result and remove this operator. number.set(i.... is for this replacement, it may be in the index position. I´v added some coments in this code part.
30th Jan 2020, 9:57 AM
Julio Codesal
Julio Codesal - avatar
0
30th Aug 2020, 10:06 AM
Naveen Surya
Naveen Surya - avatar
0
Naveen Surya --> Either your code is totally buggy, or else Java doesn't accept ScriptEngineManager anymore, because it failed all tests.
13th Mar 2021, 11:03 PM
Quantum
Quantum - avatar