Yesoda Sanka 6 years ago
parent
commit
f7fa54b140
1 changed files with 8 additions and 8 deletions
  1. 8
    8
      src/main/java/rocks/zipcode/calcskin/CalcSkin.java

+ 8
- 8
src/main/java/rocks/zipcode/calcskin/CalcSkin.java View File

@@ -24,10 +24,10 @@ public class CalcSkin extends Application {
24 24
         launch(args);
25 25
     }
26 26
     private static final String[][] template = {
27
-            { "7", "8", "9", "sin" ,"sroot","/"},
28
-            { "4", "5", "6", "cos","xsqu","*" },
29
-            { "1", "2", "3", "tan"," power","-" },
30
-            { "0", "c", "=", "inverse","Mod","+" }
27
+            { "7", "8", "9", "sin"  , "sroot", "/"},
28
+            { "4", "5", "6", "cos"  , "xsqu" , "*" },
29
+            { "1", "2", "3", "tan"  , "pwr"  , "-" },
30
+            { "0", "c", "=", "iver", "mod"  , "+" }
31 31
 
32 32
     };
33 33
 
@@ -85,7 +85,7 @@ public class CalcSkin extends Application {
85 85
         screen.setStyle("-fx-background-color: pink;");
86 86
         screen.setAlignment(Pos.CENTER_RIGHT);
87 87
         screen.setEditable(false);
88
-            screen.textProperty().bind(Bindings.format("%.0f", currentValue));
88
+            screen.textProperty().bind(Bindings.format("%.3f", currentValue));
89 89
         return screen;
90 90
     }
91 91
 
@@ -132,10 +132,10 @@ public class CalcSkin extends Application {
132 132
             case "sin": triggerOp.set(Op.SIN);    break;
133 133
             case "cos": triggerOp.set(Op.COS);    break;
134 134
             case "tan": triggerOp.set(Op.TAN);    break;
135
-            case "inverse": triggerOp.set(Op.INVERSE);   break;
135
+            case "iver": triggerOp.set(Op.INVERSE);   break;
136 136
             case "sroot": triggerOp.set(Op.SROOT);       break;
137 137
             case "xsqu": triggerOp.set(Op.XSQU );        break;
138
-            case "power": triggerOp.set(Op.POWER);       break;
138
+            case "pwr": triggerOp.set(Op.POWER);       break;
139 139
             case "mod": triggerOp.set(Op.MOD);           break;
140 140
 
141 141
         }
@@ -192,6 +192,7 @@ public class CalcSkin extends Application {
192 192
             @Override
193 193
             public void handle(ActionEvent actionEvent) {
194 194
                 switch (stackOp) {
195
+                    case POWER :  currentValue.set(calcEngine.power(previousValue.get(),currentValue.get())); break;
195 196
                     case ADD:      currentValue.set(calcEngine.add(previousValue.get(), currentValue.get())); break;
196 197
                     case SUBTRACT: currentValue.set(calcEngine.subtract(previousValue.get(), currentValue.get())); break;
197 198
                     case MULTIPLY: currentValue.set(calcEngine.multiply(previousValue.get(), currentValue.get())); break;
@@ -202,7 +203,6 @@ public class CalcSkin extends Application {
202 203
                     case INVERSE :   currentValue.set(calcEngine.inverse(currentValue.get())); break;
203 204
                     case SROOT :   currentValue.set(calcEngine.sroot(currentValue.get())); break;
204 205
                     case XSQU :  currentValue.set(calcEngine.xsqu(currentValue.get())); break;
205
-                    case POWER :  currentValue.set(calcEngine.power(previousValue.get(),currentValue.get())); break;
206 206
                     case MOD:   currentValue.set(calcEngine.mod(previousValue.get(),currentValue.get())); break;
207 207
                 }
208 208
             }