Sfoglia il codice sorgente

JK now I actually fixed error for div by 0

Lauren Green 6 anni fa
parent
commit
e9d881ac1d
1 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. 3
    2
      Console.java

+ 3
- 2
Console.java Vedi File

@@ -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();