Bladeren bron

JK now I actually fixed error for div by 0

Lauren Green 6 jaren geleden
bovenliggende
commit
e9d881ac1d
1 gewijzigde bestanden met toevoegingen van 3 en 2 verwijderingen
  1. 3
    2
      Console.java

+ 3
- 2
Console.java Bestand weergeven

@@ -59,6 +59,7 @@ public class Console {
59 59
                     //error message when trying to divide by 0.
60 60
                     if (basicInput2 == 0) {
61 61
                         Console.println("undefined");
62
+                        basicAnswer = Double.NaN;
62 63
                         //Insert return to main menu.
63 64
                     } else {
64 65
                         basicAnswer = basicCalc.getQuotient(basicInput1, basicInput2);
@@ -72,9 +73,9 @@ public class Console {
72 73
                     basicAnswer = Double.NaN;
73 74
                     Console.println("Invalid Input");
74 75
                 }
75
-                if (!basicMode.equals("4") && !(basicInput2 == 0)) {
76
+                
76 77
                 Console.println(Double.toString(basicAnswer));
77
-            }
78
+            
78 79
                 break;
79 80
                 case "2":
80 81
                 advCalc.realAdvanced();