Przeglądaj źródła

workind calculator with exponent, sqrt, invert and square

mpierse 6 lat temu
rodzic
commit
2394b703e8

+ 3
- 3
src/main/java/rocks/zipcode/calcskin/CalcSkin.java Wyświetl plik

36
     private DoubleProperty currentValue = new SimpleDoubleProperty();
36
     private DoubleProperty currentValue = new SimpleDoubleProperty();
37
     private CalcEngine calcEngine = new CalcEngine();
37
     private CalcEngine calcEngine = new CalcEngine();
38
 
38
 
39
-    private enum Op { NOOP, ADD, SUBTRACT, MULTIPLY, DIVIDE, SQUARED, SQUAREROOT, INVERT, EXPONENT  }
39
+    private enum Op { NOOP, ADD, SUBTRACT, MULTIPLY, DIVIDE, EXPONENT  }
40
 
40
 
41
     private Op curOp   = Op.NOOP;
41
     private Op curOp   = Op.NOOP;
42
     private Op stackOp = Op.NOOP;
42
     private Op stackOp = Op.NOOP;
84
         screen.setStyle("-fx-background-color: aquamarine;");
84
         screen.setStyle("-fx-background-color: aquamarine;");
85
         screen.setAlignment(Pos.CENTER_RIGHT);
85
         screen.setAlignment(Pos.CENTER_RIGHT);
86
         screen.setEditable(false);
86
         screen.setEditable(false);
87
-        screen.textProperty().bind(Bindings.format("%.0f", currentValue));
87
+        screen.textProperty().bind(Bindings.format("%.4f", currentValue));
88
         return screen;
88
         return screen;
89
     }
89
     }
90
 
90
 
118
                 makeSquareButton(button);
118
                 makeSquareButton(button);
119
             } else if ("sqrt".equals(s)){
119
             } else if ("sqrt".equals(s)){
120
                 makeSquareRootButton(button);
120
                 makeSquareRootButton(button);
121
-            } else if ("i/x".equals(s)){
121
+            } else if ("1/x".equals(s)){
122
                 makeInvertButton(button);
122
                 makeInvertButton(button);
123
             }
123
             }
124
         }
124
         }