Browse Source

Completed lab.

William Brown 6 years ago
parent
commit
05d6e28544

BIN
.DS_Store View File


BIN
src/.DS_Store View File


BIN
src/main/.DS_Store View File


BIN
src/main/java/.DS_Store View File


BIN
src/main/java/rocks/.DS_Store View File


BIN
src/main/java/rocks/zipcode/.DS_Store View File


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

@@ -6,18 +6,22 @@ public class CalcEngine {
6 6
     }
7 7
 
8 8
     public double add(double v, double v1) {
9
-        return Double.NaN;
9
+        double add = v + v1;
10
+        return add;
10 11
     }
11 12
 
12 13
     public double subtract(double v, double v1) {
13
-        return Double.NaN;
14
+        double sub = v - v1;
15
+        return sub;
14 16
     }
15 17
 
16 18
     public double multiply(double v, double v1) {
17
-        return Double.NaN;
19
+        double product = v * v1;
20
+        return product;
18 21
     }
19 22
 
20 23
     public double divide(double v, double v1) {
21
-        return Double.NaN;
24
+        double div = v / v1;
25
+        return div;
22 26
     }
23 27
 }

+ 5
- 5
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", "/" },
28
-            { "4", "5", "6", "*" },
29
-            { "1", "2", "3", "-" },
30
-            { "0", "c", "=", "+" }
27
+            {"7", "8", "9", "/" },
28
+            {"4", "5", "6", "*" },
29
+            {"1", "2", "3", "-" },
30
+            {"0", "c", "=", "+" }
31 31
     };
32 32
 
33 33
     private final Map<String, Button> accelerators = new HashMap<>();
@@ -50,7 +50,7 @@ public class CalcSkin extends Application {
50 50
         final TextField screen  = createScreen();
51 51
         final TilePane  buttons = createButtons();
52 52
 
53
-        stage.setTitle("Calc");
53
+        stage.setTitle("Calculator");
54 54
         stage.initStyle(StageStyle.UTILITY);
55 55
         stage.setResizable(false);
56 56
         stage.setScene(new Scene(createLayout(screen, buttons)));

+ 0
- 1
src/main/java/rocks/zipcode/calcskin/MainApplication.java View File

@@ -5,7 +5,6 @@ import rocks.zipcode.calcskin.CalcSkin;
5 5
 // You probably should make NO changes here. Keep it simple.
6 6
 public class MainApplication {
7 7
     public static void main(String[] args){
8
-
9 8
         CalcSkin.launchCalc(args);
10 9
     }
11 10