Ad
  • Custom User Avatar

    Input for failing test cases is not "+". The error means that at some point, your oslution attempts to parse the string "+" as a number.

    Your solution crashes for following inputs:

    Input expression: 12*-1
    For input string: "+"
    Stack Trace
    java.lang.NumberFormatException: For input string: "+"
    	at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
    	at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
    	at java.base/java.lang.Double.parseDouble(Double.java:651)
    	at MathEvaluator.getNumberOnTheRight(MathEvaluator.java:91)
    	at MathEvaluator.calculates(MathEvaluator.java:72)
    	at MathEvaluator.calculate(MathEvaluator.java:30)
    	at TestSuite$MathEvaluatorTest.test(TestSuite.java:57)
      [...]
    
    Input expression: 12* 123/-(-5 + 2)
    For input string: "-"
    Stack Trace
    java.lang.NumberFormatException: For input string: "-"
    	at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
    	at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
    	at java.base/java.lang.Double.parseDouble(Double.java:651)
    	at MathEvaluator.getNumberOnTheRight(MathEvaluator.java:91)
    	at MathEvaluator.calculates(MathEvaluator.java:72)
    	at MathEvaluator.calculate(MathEvaluator.java:30)
    	at TestSuite$MathEvaluatorTest.test(TestSuite.java:57)
      [...]
    
    Input expression: (123.45*(678.90 / (-2.5+ 11.5)-(((80 -(19))) *33.25)) / 20) - (123.45*(678.90 / (-2.5+ 11.5)-(((80 -(19))) *33.25)) / 20) + (13 - 2)/ -(-11) 
    For input string: "-"
    Stack Trace
    java.lang.NumberFormatException: For input string: "-"
    	at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
    	at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
    	at java.base/java.lang.Double.parseDouble(Double.java:651)
    	at MathEvaluator.getNumberOnTheRight(MathEvaluator.java:91)
    	at MathEvaluator.calculates(MathEvaluator.java:72)
    	at MathEvaluator.calculate(MathEvaluator.java:30)
    	at TestSuite$MathEvaluatorTest.test(TestSuite.java:57)
      [...]
      
    Input expression: 12 * -123
    For input string: "+"
    Stack Trace
    java.lang.NumberFormatException: For input string: "+"
    	at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
    	at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
    	at java.base/java.lang.Double.parseDouble(Double.java:651)
    	at MathEvaluator.getNumberOnTheRight(MathEvaluator.java:91)
    	at MathEvaluator.calculates(MathEvaluator.java:72)
    	at MathEvaluator.calculate(MathEvaluator.java:30)
    	at TestSuite$MathEvaluatorTest.test(TestSuite.java:57)
    	[...]
    

    All stacktraces seem to originate from MathEvaluator.getNumberOnTheRight(MathEvaluator.java:91), so you need to search for error in your solution somewhere around there.