diff --git a/recordList.txt b/recordList.txt index b1316af745..530feb8990 100644 --- a/recordList.txt +++ b/recordList.txt @@ -8,3 +8,4 @@ 2024-04-10 15:37:53 0.11764705882352941 0.0 854452107 75-65,10.0 17/4,4.25 3/4,0.75 57/8,7.125 84*38,3192.0 79*92,7268.0 45+21,66.0 45*5,225.0 61-89,-28.0 62+68,130.0 2024-04-10 16:08:33 0.29411764705882354 0.4 1784552838 36+17,53.0 19+13,32.0 49/2,24.5 28+16,44.0 76+32,108.0 25*22,550.0 34+42,76.0 28-94,-66.0 0-72,-72.0 96/7,13.714285714285714 2024-04-10 16:19:08 0.20833333333333334 0.3 1784552838 53/6,8.833333333333334 1-71,-70.0 78-57,21.0 75-54,21.0 15/2,7.5 6+59,65.0 57+81,138.0 56+2,58.0 7-49,-42.0 33+87,120.0 +2024-04-12 01:10:44 75.0 0.0 198423881 27/8,3.375 66+27,93.0 78+22,100.0 70-55,15.0 13*28,364.0 18+25,43.0 95-12,83.0 62-8,54.0 32+63,95.0 40-51,-11.0 diff --git a/src/main/java/seedu/duke/Calculator.java b/src/main/java/seedu/duke/Calculator.java index a9c8d11253..3e8101988c 100644 --- a/src/main/java/seedu/duke/Calculator.java +++ b/src/main/java/seedu/duke/Calculator.java @@ -57,7 +57,8 @@ private static ArrayList toSuffix(ArrayList formula) { for (Object object : formula) { if (object instanceof Integer) { suffix.add(object); - } else if (object instanceof String op) { + } else if (object instanceof String ) { + String op = (String) object; if (opStack.empty()) { opStack.push(op); diff --git a/src/main/java/seedu/duke/Checker.java b/src/main/java/seedu/duke/Checker.java index f6ffe09e95..502ade2a35 100644 --- a/src/main/java/seedu/duke/Checker.java +++ b/src/main/java/seedu/duke/Checker.java @@ -111,13 +111,20 @@ void getUserAnswer() { userInput = ui.readCommand(); userAnswer[i] = userInput; double answer = Double.NEGATIVE_INFINITY; - try { - answer = Double.parseDouble(userInput); - } catch (NumberFormatException e) { - ui.print("Invalid Input, please enter a number"); - wrongAnswer.add(userInput); - wrongProblem.add(problem); - continue; + boolean isValid = false; + while (!isValid) { + + try { + answer = Double.parseDouble(userInput); + isValid = true; + } catch (NumberFormatException e) { + ui.print("Invalid Input, please enter a number"); + //wrongAnswer.add(userInput); + //wrongProblem.add(problem); + //continue; + userInput = ui.readCommand(); + + } } if (checkCorrectness(problem, answer)) {