Browse Source

first commit

Carolynn Vansant 6 years ago
parent
commit
748caf522d

+ 1
- 1
.idea/compiler.xml View File

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

+ 0
- 7
.idea/kotlinc.xml View File

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 View File

7
       </list>
7
       </list>
8
     </option>
8
     </option>
9
   </component>
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
   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
10
   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
27
     <output url="file://$PROJECT_DIR$/classes" />
11
     <output url="file://$PROJECT_DIR$/classes" />
28
   </component>
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
 </project>
13
 </project>

+ 51
- 26
src/main/java/com/zipcodewilmington/danny_do_better_exercises/MathUtilities.java View File

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

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

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

+ 1
- 1
src/main/java/com/zipcodewilmington/danny_do_better_exercises/ZipcodeRocks.java View File

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

BIN
target/classes/com/zipcodewilmington/danny_do_better_exercises/MathUtilities.class View File


BIN
target/classes/com/zipcodewilmington/danny_do_better_exercises/PredicateUtilities.class View File


BIN
target/classes/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.class View File


BIN
target/classes/com/zipcodewilmington/danny_do_better_exercises/ZipcodeRocks.class View File