Carolynn Vansant 6 年 前
コミット
748caf522d

+ 1
- 1
.idea/compiler.xml ファイルの表示

@@ -9,7 +9,7 @@
9 9
         <module name="ChapterOneMicro" />
10 10
       </profile>
11 11
     </annotationProcessing>
12
-    <bytecodeTargetLevel target="1.8">
12
+    <bytecodeTargetLevel>
13 13
       <module name="ChapterOneMicro" target="1.8" />
14 14
     </bytecodeTargetLevel>
15 15
   </component>

+ 0
- 7
.idea/kotlinc.xml ファイルの表示

@@ -1,7 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="KotlinCommonCompilerArguments">
4
-    <option name="languageVersion" value="1.1" />
5
-    <option name="apiVersion" value="1.1" />
6
-  </component>
7
-</project>

+ 0
- 77
.idea/misc.xml ファイルの表示

@@ -7,84 +7,7 @@
7 7
       </list>
8 8
     </option>
9 9
   </component>
10
-  <component name="ProjectInspectionProfilesVisibleTreeState">
11
-    <entry key="Project Default">
12
-      <profile-state>
13
-        <expanded-state>
14
-          <State>
15
-            <id />
16
-          </State>
17
-        </expanded-state>
18
-        <selected-state>
19
-          <State>
20
-            <id>Android</id>
21
-          </State>
22
-        </selected-state>
23
-      </profile-state>
24
-    </entry>
25
-  </component>
26 10
   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
27 11
     <output url="file://$PROJECT_DIR$/classes" />
28 12
   </component>
29
-  <component name="masterDetails">
30
-    <states>
31
-      <state key="GlobalLibrariesConfigurable.UI">
32
-        <settings>
33
-          <splitter-proportions>
34
-            <option name="proportions">
35
-              <list>
36
-                <option value="0.2" />
37
-              </list>
38
-            </option>
39
-          </splitter-proportions>
40
-        </settings>
41
-      </state>
42
-      <state key="JdkListConfigurable.UI">
43
-        <settings>
44
-          <last-edited>1.8</last-edited>
45
-          <splitter-proportions>
46
-            <option name="proportions">
47
-              <list>
48
-                <option value="0.2" />
49
-              </list>
50
-            </option>
51
-          </splitter-proportions>
52
-        </settings>
53
-      </state>
54
-      <state key="ProjectJDKs.UI">
55
-        <settings>
56
-          <last-edited>1.8</last-edited>
57
-          <splitter-proportions>
58
-            <option name="proportions">
59
-              <list>
60
-                <option value="0.2" />
61
-              </list>
62
-            </option>
63
-          </splitter-proportions>
64
-        </settings>
65
-      </state>
66
-      <state key="ProjectLibrariesConfigurable.UI">
67
-        <settings>
68
-          <splitter-proportions>
69
-            <option name="proportions">
70
-              <list>
71
-                <option value="0.2" />
72
-              </list>
73
-            </option>
74
-          </splitter-proportions>
75
-        </settings>
76
-      </state>
77
-      <state key="ScopeChooserConfigurable.UI">
78
-        <settings>
79
-          <splitter-proportions>
80
-            <option name="proportions">
81
-              <list>
82
-                <option value="0.2" />
83
-              </list>
84
-            </option>
85
-          </splitter-proportions>
86
-        </settings>
87
-      </state>
88
-    </states>
89
-  </component>
90 13
 </project>

+ 51
- 26
src/main/java/com/zipcodewilmington/danny_do_better_exercises/MathUtilities.java ファイルの表示

@@ -10,8 +10,9 @@ public class MathUtilities {
10 10
      * @param difference value to add to starting value
11 11
      * @return sum of `baseValue` and `difference`
12 12
      */
13
+
13 14
     public Integer add(int baseValue, int difference) {
14
-        return null;
15
+        return baseValue + difference;
15 16
     }
16 17
 
17 18
     /**
@@ -20,7 +21,7 @@ public class MathUtilities {
20 21
      * @return sum of `baseValue` and `difference`
21 22
      */
22 23
     public Long add(long baseValue, long difference) {
23
-        return null;
24
+        return baseValue + difference;
24 25
     }
25 26
 
26 27
     /**
@@ -29,7 +30,8 @@ public class MathUtilities {
29 30
      * @return sum of `baseValue` and `difference`
30 31
      */
31 32
     public Short add(short baseValue, short difference) {
32
-        return null;
33
+
34
+        return (short)(baseValue + difference);
33 35
     }
34 36
 
35 37
     /**
@@ -38,7 +40,8 @@ public class MathUtilities {
38 40
      * @return sum of `baseValue` and `difference`
39 41
      */
40 42
     public Byte add(byte baseValue, byte difference) {
41
-        return null;
43
+
44
+        return (byte)(baseValue + difference);
42 45
     }
43 46
 
44 47
     /**
@@ -47,7 +50,8 @@ public class MathUtilities {
47 50
      * @return sum of `baseValue` and `difference`
48 51
      */
49 52
     public Float add(float baseValue, float difference) {
50
-        return null;
53
+
54
+        return (float)(baseValue + difference);
51 55
     }
52 56
 
53 57
     /**
@@ -56,7 +60,8 @@ public class MathUtilities {
56 60
      * @return sum of `baseValue` and `difference`
57 61
      */
58 62
     public Double add(double baseValue, double difference) {
59
-        return null;
63
+
64
+        return (double)(baseValue + difference);
60 65
     }
61 66
 
62 67
     /**
@@ -65,7 +70,8 @@ public class MathUtilities {
65 70
      * @return difference between `baseValue` and `difference`
66 71
      */
67 72
     public Integer subtract(int baseValue, int difference) {
68
-        return null;
73
+
74
+        return baseValue - difference;
69 75
     }
70 76
 
71 77
     /**
@@ -74,7 +80,8 @@ public class MathUtilities {
74 80
      * @return difference between `baseValue` and `difference`
75 81
      */
76 82
     public Long subtract(long baseValue, long difference) {
77
-        return null;
83
+
84
+        return baseValue - difference;
78 85
     }
79 86
 
80 87
     /**
@@ -83,7 +90,8 @@ public class MathUtilities {
83 90
      * @return difference between `baseValue` and `difference`
84 91
      */
85 92
     public Short subtract(short baseValue, short difference) {
86
-        return null;
93
+
94
+        return (short)(baseValue - difference);
87 95
     }
88 96
 
89 97
     /**
@@ -92,7 +100,8 @@ public class MathUtilities {
92 100
      * @return difference between `baseValue` and `difference`
93 101
      */
94 102
     public Byte subtract(byte baseValue, byte difference) {
95
-        return null;
103
+
104
+        return (byte)(baseValue - difference);
96 105
     }
97 106
 
98 107
     /**
@@ -101,7 +110,8 @@ public class MathUtilities {
101 110
      * @return difference between `baseValue` and `difference`
102 111
      */
103 112
     public Float subtract(float baseValue, float difference) {
104
-        return null;
113
+
114
+        return (float)(baseValue - difference);
105 115
     }
106 116
 
107 117
     /**
@@ -110,7 +120,8 @@ public class MathUtilities {
110 120
      * @return difference between `baseValue` and `difference`
111 121
      */
112 122
     public Double subtract(double baseValue, double difference) {
113
-        return null;
123
+
124
+        return (double)(baseValue - difference);
114 125
     }
115 126
 
116 127
 
@@ -120,7 +131,8 @@ public class MathUtilities {
120 131
      * @return division of `dividend` by `divisor
121 132
      */
122 133
     public Integer divide(int dividend, int divisor) {
123
-        return null;
134
+
135
+        return dividend / divisor;
124 136
     }
125 137
 
126 138
     /**
@@ -129,7 +141,8 @@ public class MathUtilities {
129 141
      * @return division of `dividend` by `divisor
130 142
      */
131 143
     public Long divide(long dividend, long divisor) {
132
-        return null;
144
+
145
+        return dividend / divisor;
133 146
     }
134 147
 
135 148
     /**
@@ -138,7 +151,8 @@ public class MathUtilities {
138 151
      * @return division of `dividend` by `divisor
139 152
      */
140 153
     public Short divide(short dividend, short divisor) {
141
-        return null;
154
+
155
+        return (short)(dividend / divisor);
142 156
     }
143 157
 
144 158
     /**
@@ -147,7 +161,8 @@ public class MathUtilities {
147 161
      * @return division of `dividend` by `divisor
148 162
      */
149 163
     public Byte divide(byte dividend, byte divisor) {
150
-        return null;
164
+
165
+        return (byte)(dividend / divisor);
151 166
     }
152 167
 
153 168
     /**
@@ -156,7 +171,8 @@ public class MathUtilities {
156 171
      * @return division of `dividend` by `divisor
157 172
      */
158 173
     public Float divide(float dividend, float divisor) {
159
-        return null;
174
+
175
+        return (float)(dividend / divisor);
160 176
     }
161 177
 
162 178
     /**
@@ -165,7 +181,8 @@ public class MathUtilities {
165 181
      * @return division of `dividend` by `divisor
166 182
      */
167 183
     public Double divide(double dividend, double divisor) {
168
-        return null;
184
+
185
+        return (double)(dividend - divisor);
169 186
     }
170 187
 
171 188
 
@@ -175,7 +192,8 @@ public class MathUtilities {
175 192
      * @return product of `multiplicand` by `multiplier`
176 193
      */
177 194
     public Integer multiply(int multiplicand, int multiplier) {
178
-        return null;
195
+
196
+        return multiplicand * multiplier;
179 197
     }
180 198
 
181 199
     /**
@@ -184,7 +202,8 @@ public class MathUtilities {
184 202
      * @return product of `multiplicand` by `multiplier`
185 203
      */
186 204
     public Long multiply(long multiplicand, long multiplier) {
187
-        return null;
205
+
206
+        return multiplicand * multiplier;
188 207
     }
189 208
 
190 209
     /**
@@ -193,7 +212,8 @@ public class MathUtilities {
193 212
      * @return product of `multiplicand` by `multiplier`
194 213
      */
195 214
     public Short multiply(short multiplicand, short multiplier) {
196
-        return null;
215
+
216
+        return (short)(multiplicand * multiplier);
197 217
     }
198 218
     /**
199 219
      * @param multiplicand value to be multiplied
@@ -201,7 +221,8 @@ public class MathUtilities {
201 221
      * @return product of `multiplicand` by `multiplier`
202 222
      */
203 223
     public Byte multiply(byte multiplicand, byte multiplier) {
204
-        return null;
224
+
225
+        return (byte)(multiplicand * multiplier);
205 226
     }
206 227
 
207 228
     /**
@@ -210,7 +231,8 @@ public class MathUtilities {
210 231
      * @return product of `multiplicand` by `multiplier`
211 232
      */
212 233
     public Float multiply(float multiplicand, float multiplier) {
213
-        return null;
234
+
235
+        return multiplicand * multiplier;
214 236
     }
215 237
 
216 238
     /**
@@ -219,7 +241,8 @@ public class MathUtilities {
219 241
      * @return product of `multiplicand` by `multiplier`
220 242
      */
221 243
     public Double multiply(double multiplicand, double multiplier) {
222
-        return null;
244
+
245
+        return multiplicand * multiplier;
223 246
     }
224 247
 
225 248
 
@@ -227,14 +250,16 @@ public class MathUtilities {
227 250
       * @return true
228 251
      */
229 252
     public Boolean returnTrue() {
230
-        return null;
253
+
254
+        return true;
231 255
     }
232 256
 
233 257
     /**
234 258
      * @return false
235 259
      */
236 260
     public Boolean returnFalse() {
237
-        return null;
261
+
262
+        return false;
238 263
     }
239 264
 
240 265
 }

+ 8
- 4
src/main/java/com/zipcodewilmington/danny_do_better_exercises/PredicateUtilities.java ファイルの表示

@@ -10,7 +10,8 @@ public class PredicateUtilities {
10 10
      * @return true if `x` is greater than `y`
11 11
      */
12 12
     public Boolean isGreaterThan(int x, int y) {
13
-        return null;
13
+
14
+        return (x > y);
14 15
     }
15 16
 
16 17
     /**
@@ -19,7 +20,8 @@ public class PredicateUtilities {
19 20
      * @return true if `x` is less than `y`
20 21
      */
21 22
     public Boolean isLessThan(int x, int y) {
22
-        return null;
23
+
24
+        return (x < y);
23 25
     }
24 26
 
25 27
     /**
@@ -28,7 +30,8 @@ public class PredicateUtilities {
28 30
      * @return true if `x` is greater than or equal to `y`
29 31
      */
30 32
     public Boolean isGreaterThanOrEqualTo(int x, int y) {
31
-        return null;
33
+
34
+        return (x >= y);
32 35
     }
33 36
 
34 37
     /**
@@ -37,6 +40,7 @@ public class PredicateUtilities {
37 40
      * @return true if `x` is less than or equal to `y`
38 41
      */
39 42
     public Boolean isLessThanOrEqualTo(int x, int y) {
40
-        return null;
43
+
44
+        return (x <= y);
41 45
     }
42 46
 }

+ 16
- 6
src/main/java/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.java ファイルの表示

@@ -1,5 +1,7 @@
1 1
 package com.zipcodewilmington.danny_do_better_exercises;
2 2
 
3
+import static java.lang.System.*;
4
+
3 5
 /**
4 6
  * Created by dan on 6/14/17.
5 7
  */
@@ -8,7 +10,9 @@ public class StringUtilities {
8 10
      * @return `Hello World` as a string
9 11
      */
10 12
     public static String getHelloWorld() {
11
-        return null;
13
+
14
+        String greeting = "Hello World";
15
+        return greeting;
12 16
     }
13 17
 
14 18
     /**
@@ -17,7 +21,8 @@ public class StringUtilities {
17 21
      * @return the concatenation of two strings, `firstSegment`, and `secondSegment`
18 22
      */
19 23
     public static String concatenation(String firstSegment, String secondSegment){
20
-        return null;
24
+
25
+        return (firstSegment + secondSegment);
21 26
     }
22 27
 
23 28
     /**
@@ -26,7 +31,8 @@ public class StringUtilities {
26 31
      * @return the concatenation of an integer, `firstSegment`, and a String, `secondSegment`
27 32
      */
28 33
     public static String concatenation(int firstSegment, String secondSegment){
29
-        return null;
34
+
35
+        return (firstSegment + secondSegment);
30 36
     }
31 37
 
32 38
     /**
@@ -34,7 +40,8 @@ public class StringUtilities {
34 40
      * @return the first 3 characters of `input`
35 41
      */
36 42
     public static String getPrefix(String input){
37
-        return null;
43
+
44
+        return input.substring(0,3);
38 45
     }
39 46
 
40 47
     /**
@@ -42,7 +49,8 @@ public class StringUtilities {
42 49
      * @return the last 3 characters of `input`
43 50
      */
44 51
     public static String getSuffix(String input){
45
-        return null;
52
+
53
+        return input.substring(input.length()-2);
46 54
     }
47 55
 
48 56
     /**
@@ -51,7 +59,8 @@ public class StringUtilities {
51 59
      * @return the equivalence of two strings, `inputValue` and `comparableValue`
52 60
      */
53 61
     public static Boolean compareTwoStrings(String inputValue, String comparableValue){
54
-        return null;
62
+
63
+        return inputValue.equals(comparableValue);
55 64
     }
56 65
 
57 66
     /**
@@ -59,6 +68,7 @@ public class StringUtilities {
59 68
      * @return the middle character of `inputValue`
60 69
      */
61 70
     public static Character getMiddleCharacter(String inputValue){
71
+
62 72
         return null;
63 73
     }
64 74
 

+ 1
- 1
src/main/java/com/zipcodewilmington/danny_do_better_exercises/ZipcodeRocks.java ファイルの表示

@@ -5,6 +5,6 @@ package com.zipcodewilmington.danny_do_better_exercises;
5 5
  */
6 6
 public class ZipcodeRocks {
7 7
     public static void main(String[] args) {
8
-//         System.out.println("Zipcode Rocks!");
8
+         System.out.println("Zipcode Rocks!");
9 9
     }
10 10
 }

バイナリ
target/classes/com/zipcodewilmington/danny_do_better_exercises/MathUtilities.class ファイルの表示


バイナリ
target/classes/com/zipcodewilmington/danny_do_better_exercises/PredicateUtilities.class ファイルの表示


バイナリ
target/classes/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.class ファイルの表示


バイナリ
target/classes/com/zipcodewilmington/danny_do_better_exercises/ZipcodeRocks.class ファイルの表示