Преглед изворни кода

Merge pull request #565 from exercism/539-space-age-starter

space-age: standardize starter implementation
FridaTveit пре 9 година
родитељ
комит
7e3f00ec3f

+ 13
- 12
exercises/space-age/src/example/java/SpaceAge.java Прегледај датотеку

@@ -1,6 +1,6 @@
1 1
 import java.math.BigDecimal;
2 2
 
3
-public class SpaceAge {
3
+class SpaceAge {
4 4
 
5 5
     private enum Planet {
6 6
         EARTH(1.0),
@@ -18,7 +18,7 @@ public class SpaceAge {
18 18
             this.relativeOrbitalPeriod = relativeOrbitalPeriod;
19 19
         }
20 20
 
21
-        public double getRelativeOrbitalPeriod() {
21
+        private double getRelativeOrbitalPeriod() {
22 22
             return relativeOrbitalPeriod;
23 23
         }
24 24
     }
@@ -28,43 +28,43 @@ public class SpaceAge {
28 28
 
29 29
     private double seconds;
30 30
 
31
-    public SpaceAge(double seconds) {
31
+    SpaceAge(double seconds) {
32 32
         this.seconds = seconds;
33 33
     }
34 34
 
35
-    public double getSeconds() {
35
+    double getSeconds() {
36 36
         return seconds;
37 37
     }
38 38
 
39
-    public double onEarth() {
39
+    double onEarth() {
40 40
         return calculateAge(Planet.EARTH);
41 41
     }
42 42
 
43
-    public double onMercury() {
43
+    double onMercury() {
44 44
         return calculateAge(Planet.MERCURY);
45 45
     }
46 46
 
47
-    public double onVenus() {
47
+    double onVenus() {
48 48
         return calculateAge(Planet.VENUS);
49 49
     }
50 50
 
51
-    public double onMars() {
51
+    double onMars() {
52 52
         return calculateAge(Planet.MARS);
53 53
     }
54 54
 
55
-    public double onJupiter() {
55
+    double onJupiter() {
56 56
         return calculateAge(Planet.JUPITER);
57 57
     }
58 58
 
59
-    public double onSaturn() {
59
+    double onSaturn() {
60 60
         return calculateAge(Planet.SATURN);
61 61
     }
62 62
 
63
-    public double onUranus() {
63
+    double onUranus() {
64 64
         return calculateAge(Planet.URANUS);
65 65
     }
66 66
 
67
-    public double onNeptune() {
67
+    double onNeptune() {
68 68
         return calculateAge(Planet.NEPTUNE);
69 69
     }
70 70
 
@@ -73,4 +73,5 @@ public class SpaceAge {
73 73
 
74 74
         return new BigDecimal(age).setScale(PRECISION, BigDecimal.ROUND_HALF_UP).doubleValue();
75 75
     }
76
+
76 77
 }

+ 0
- 0
exercises/space-age/src/main/java/.keep Прегледај датотеку


+ 43
- 0
exercises/space-age/src/main/java/SpaceAge.java Прегледај датотеку

@@ -0,0 +1,43 @@
1
+class SpaceAge {
2
+
3
+    SpaceAge(double seconds) {
4
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
5
+    }
6
+
7
+    double getSeconds() {
8
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
9
+    }
10
+
11
+    double onEarth() {
12
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
13
+    }
14
+
15
+    double onMercury() {
16
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
17
+    }
18
+
19
+    double onVenus() {
20
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
21
+    }
22
+
23
+    double onMars() {
24
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
25
+    }
26
+
27
+    double onJupiter() {
28
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
29
+    }
30
+
31
+    double onSaturn() {
32
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
33
+    }
34
+
35
+    double onUranus() {
36
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
37
+    }
38
+
39
+    double onNeptune() {
40
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
41
+    }
42
+
43
+}