Browse Source

Merge c7d24f144ca4b1569fcb5dabd1058ff936c7f51a into 913fc8b71dfcb9ab6e5834ab57b3411cc112752d

wulawrence 6 years ago
parent
commit
4afbe8a460
No account linked to committer's email

+ 2
- 0
ChapterOneMicro.iml View File

12
     <orderEntry type="sourceFolder" forTests="false" />
12
     <orderEntry type="sourceFolder" forTests="false" />
13
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
13
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
14
     <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
14
     <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
15
+    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
16
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
15
   </component>
17
   </component>
16
 </module>
18
 </module>

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

11
      * @return sum of `baseValue` and `difference`
11
      * @return sum of `baseValue` and `difference`
12
      */
12
      */
13
     public Integer add(int baseValue, int difference) {
13
     public Integer add(int baseValue, int difference) {
14
-        return null;
14
+        return baseValue + difference;
15
     }
15
     }
16
 
16
 
17
     /**
17
     /**
20
      * @return sum of `baseValue` and `difference`
20
      * @return sum of `baseValue` and `difference`
21
      */
21
      */
22
     public Long add(long baseValue, long difference) {
22
     public Long add(long baseValue, long difference) {
23
-        return null;
23
+        return (Long) baseValue + difference;
24
     }
24
     }
25
 
25
 
26
     /**
26
     /**
29
      * @return sum of `baseValue` and `difference`
29
      * @return sum of `baseValue` and `difference`
30
      */
30
      */
31
     public Short add(short baseValue, short difference) {
31
     public Short add(short baseValue, short difference) {
32
-        return null;
32
+        return (short) (baseValue + difference);
33
     }
33
     }
34
 
34
 
35
     /**
35
     /**
38
      * @return sum of `baseValue` and `difference`
38
      * @return sum of `baseValue` and `difference`
39
      */
39
      */
40
     public Byte add(byte baseValue, byte difference) {
40
     public Byte add(byte baseValue, byte difference) {
41
-        return null;
41
+        return (byte)(baseValue + difference);
42
     }
42
     }
43
 
43
 
44
     /**
44
     /**
47
      * @return sum of `baseValue` and `difference`
47
      * @return sum of `baseValue` and `difference`
48
      */
48
      */
49
     public Float add(float baseValue, float difference) {
49
     public Float add(float baseValue, float difference) {
50
-        return null;
50
+        return (float) (baseValue + difference);
51
     }
51
     }
52
 
52
 
53
     /**
53
     /**
56
      * @return sum of `baseValue` and `difference`
56
      * @return sum of `baseValue` and `difference`
57
      */
57
      */
58
     public Double add(double baseValue, double difference) {
58
     public Double add(double baseValue, double difference) {
59
-        return null;
59
+        return (double) (baseValue + difference);
60
     }
60
     }
61
 
61
 
62
     /**
62
     /**
65
      * @return difference between `baseValue` and `difference`
65
      * @return difference between `baseValue` and `difference`
66
      */
66
      */
67
     public Integer subtract(int baseValue, int difference) {
67
     public Integer subtract(int baseValue, int difference) {
68
-        return null;
68
+        return (int) (baseValue - difference);
69
     }
69
     }
70
 
70
 
71
     /**
71
     /**
74
      * @return difference between `baseValue` and `difference`
74
      * @return difference between `baseValue` and `difference`
75
      */
75
      */
76
     public Long subtract(long baseValue, long difference) {
76
     public Long subtract(long baseValue, long difference) {
77
-        return null;
77
+        return (Long)(baseValue - difference);
78
     }
78
     }
79
 
79
 
80
     /**
80
     /**
83
      * @return difference between `baseValue` and `difference`
83
      * @return difference between `baseValue` and `difference`
84
      */
84
      */
85
     public Short subtract(short baseValue, short difference) {
85
     public Short subtract(short baseValue, short difference) {
86
-        return null;
86
+        return (short)(baseValue - difference);
87
     }
87
     }
88
 
88
 
89
     /**
89
     /**
92
      * @return difference between `baseValue` and `difference`
92
      * @return difference between `baseValue` and `difference`
93
      */
93
      */
94
     public Byte subtract(byte baseValue, byte difference) {
94
     public Byte subtract(byte baseValue, byte difference) {
95
-        return null;
95
+        return (byte) (baseValue - difference);
96
     }
96
     }
97
 
97
 
98
     /**
98
     /**
101
      * @return difference between `baseValue` and `difference`
101
      * @return difference between `baseValue` and `difference`
102
      */
102
      */
103
     public Float subtract(float baseValue, float difference) {
103
     public Float subtract(float baseValue, float difference) {
104
-        return null;
104
+        return (baseValue - difference);
105
     }
105
     }
106
 
106
 
107
     /**
107
     /**
110
      * @return difference between `baseValue` and `difference`
110
      * @return difference between `baseValue` and `difference`
111
      */
111
      */
112
     public Double subtract(double baseValue, double difference) {
112
     public Double subtract(double baseValue, double difference) {
113
-        return null;
113
+        return (double) (baseValue - difference);
114
     }
114
     }
115
 
115
 
116
 
116
 
120
      * @return division of `dividend` by `divisor
120
      * @return division of `dividend` by `divisor
121
      */
121
      */
122
     public Integer divide(int dividend, int divisor) {
122
     public Integer divide(int dividend, int divisor) {
123
-        return null;
123
+        return (int) (dividend / divisor);
124
     }
124
     }
125
 
125
 
126
     /**
126
     /**
129
      * @return division of `dividend` by `divisor
129
      * @return division of `dividend` by `divisor
130
      */
130
      */
131
     public Long divide(long dividend, long divisor) {
131
     public Long divide(long dividend, long divisor) {
132
-        return null;
132
+        return (long) (dividend / divisor);
133
     }
133
     }
134
 
134
 
135
     /**
135
     /**
138
      * @return division of `dividend` by `divisor
138
      * @return division of `dividend` by `divisor
139
      */
139
      */
140
     public Short divide(short dividend, short divisor) {
140
     public Short divide(short dividend, short divisor) {
141
-        return null;
141
+        return (short) (dividend / divisor);
142
     }
142
     }
143
 
143
 
144
     /**
144
     /**
147
      * @return division of `dividend` by `divisor
147
      * @return division of `dividend` by `divisor
148
      */
148
      */
149
     public Byte divide(byte dividend, byte divisor) {
149
     public Byte divide(byte dividend, byte divisor) {
150
-        return null;
150
+        return (byte) (dividend / divisor);
151
     }
151
     }
152
 
152
 
153
     /**
153
     /**
156
      * @return division of `dividend` by `divisor
156
      * @return division of `dividend` by `divisor
157
      */
157
      */
158
     public Float divide(float dividend, float divisor) {
158
     public Float divide(float dividend, float divisor) {
159
-        return null;
159
+        return (float) (dividend / divisor);
160
     }
160
     }
161
 
161
 
162
     /**
162
     /**
165
      * @return division of `dividend` by `divisor
165
      * @return division of `dividend` by `divisor
166
      */
166
      */
167
     public Double divide(double dividend, double divisor) {
167
     public Double divide(double dividend, double divisor) {
168
-        return null;
168
+        return (double) (dividend / divisor);
169
     }
169
     }
170
 
170
 
171
 
171
 
175
      * @return product of `multiplicand` by `multiplier`
175
      * @return product of `multiplicand` by `multiplier`
176
      */
176
      */
177
     public Integer multiply(int multiplicand, int multiplier) {
177
     public Integer multiply(int multiplicand, int multiplier) {
178
-        return null;
178
+        return (int) (multiplicand * multiplier);
179
     }
179
     }
180
 
180
 
181
     /**
181
     /**
184
      * @return product of `multiplicand` by `multiplier`
184
      * @return product of `multiplicand` by `multiplier`
185
      */
185
      */
186
     public Long multiply(long multiplicand, long multiplier) {
186
     public Long multiply(long multiplicand, long multiplier) {
187
-        return null;
187
+        return (long) (multiplicand * multiplier);
188
     }
188
     }
189
 
189
 
190
     /**
190
     /**
193
      * @return product of `multiplicand` by `multiplier`
193
      * @return product of `multiplicand` by `multiplier`
194
      */
194
      */
195
     public Short multiply(short multiplicand, short multiplier) {
195
     public Short multiply(short multiplicand, short multiplier) {
196
-        return null;
196
+        return (short) (multiplicand * multiplier);
197
     }
197
     }
198
     /**
198
     /**
199
      * @param multiplicand value to be multiplied
199
      * @param multiplicand value to be multiplied
201
      * @return product of `multiplicand` by `multiplier`
201
      * @return product of `multiplicand` by `multiplier`
202
      */
202
      */
203
     public Byte multiply(byte multiplicand, byte multiplier) {
203
     public Byte multiply(byte multiplicand, byte multiplier) {
204
-        return null;
204
+
205
+        return (byte)(multiplicand * multiplier);
205
     }
206
     }
206
 
207
 
207
     /**
208
     /**
210
      * @return product of `multiplicand` by `multiplier`
211
      * @return product of `multiplicand` by `multiplier`
211
      */
212
      */
212
     public Float multiply(float multiplicand, float multiplier) {
213
     public Float multiply(float multiplicand, float multiplier) {
213
-        return null;
214
+        return (float) (multiplicand * multiplier);
214
     }
215
     }
215
 
216
 
216
     /**
217
     /**
219
      * @return product of `multiplicand` by `multiplier`
220
      * @return product of `multiplicand` by `multiplier`
220
      */
221
      */
221
     public Double multiply(double multiplicand, double multiplier) {
222
     public Double multiply(double multiplicand, double multiplier) {
222
-        return null;
223
+        return (double) (multiplicand * multiplier);
223
     }
224
     }
224
 
225
 
225
 
226
 
227
       * @return true
228
       * @return true
228
      */
229
      */
229
     public Boolean returnTrue() {
230
     public Boolean returnTrue() {
230
-        return null;
231
+        return true;
231
     }
232
     }
232
 
233
 
233
     /**
234
     /**
234
      * @return false
235
      * @return false
235
      */
236
      */
236
     public Boolean returnFalse() {
237
     public Boolean returnFalse() {
237
-        return null;
238
+        return false;
238
     }
239
     }
239
 
240
 
240
 }
241
 }

+ 23
- 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
+        if (x > y){
14
+            return true;
15
+        }
16
+        else {
17
+            return false;
18
+        }
14
     }
19
     }
15
 
20
 
16
     /**
21
     /**
19
      * @return true if `x` is less than `y`
24
      * @return true if `x` is less than `y`
20
      */
25
      */
21
     public Boolean isLessThan(int x, int y) {
26
     public Boolean isLessThan(int x, int y) {
22
-        return null;
27
+       if (x < y){
28
+           return true;
29
+       }
30
+       else {
31
+           return false;
32
+       }
23
     }
33
     }
24
 
34
 
25
     /**
35
     /**
28
      * @return true if `x` is greater than or equal to `y`
38
      * @return true if `x` is greater than or equal to `y`
29
      */
39
      */
30
     public Boolean isGreaterThanOrEqualTo(int x, int y) {
40
     public Boolean isGreaterThanOrEqualTo(int x, int y) {
31
-        return null;
41
+        if (x >= y){
42
+            return true;
43
+        }
44
+        else {
45
+            return false;
46
+        }
32
     }
47
     }
33
 
48
 
34
     /**
49
     /**
37
      * @return true if `x` is less than or equal to `y`
52
      * @return true if `x` is less than or equal to `y`
38
      */
53
      */
39
     public Boolean isLessThanOrEqualTo(int x, int y) {
54
     public Boolean isLessThanOrEqualTo(int x, int y) {
40
-        return null;
55
+        if (x <= y){
56
+            return true;
57
+        } else {
58
+            return false;
59
+        }
41
     }
60
     }
42
 }
61
 }

+ 40
- 23
src/main/java/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.java View File

8
      * @return `Hello World` as a string
8
      * @return `Hello World` as a string
9
      */
9
      */
10
     public static String getHelloWorld() {
10
     public static String getHelloWorld() {
11
-        return null;
11
+        return "Hello World";
12
+
12
     }
13
     }
13
 
14
 
14
     /**
15
     /**
15
-     * @param firstSegment a string to be added to
16
+     * @param firstSegment  a string to be added to
16
      * @param secondSegment a string to add
17
      * @param secondSegment a string to add
17
      * @return the concatenation of two strings, `firstSegment`, and `secondSegment`
18
      * @return the concatenation of two strings, `firstSegment`, and `secondSegment`
18
      */
19
      */
19
-    public static String concatenation(String firstSegment, String secondSegment){
20
-        return null;
20
+    public static String concatenation(String firstSegment, String secondSegment) {
21
+        return firstSegment + secondSegment;
22
+
21
     }
23
     }
22
 
24
 
23
     /**
25
     /**
24
-     * @param firstSegment a string to be added to
26
+     * @param firstSegment  a string to be added to
25
      * @param secondSegment a string to add
27
      * @param secondSegment a string to add
26
      * @return the concatenation of an integer, `firstSegment`, and a String, `secondSegment`
28
      * @return the concatenation of an integer, `firstSegment`, and a String, `secondSegment`
27
      */
29
      */
28
-    public static String concatenation(int firstSegment, String secondSegment){
29
-        return null;
30
+    public static String concatenation(int firstSegment, String secondSegment) {
31
+        return firstSegment + secondSegment;
30
     }
32
     }
31
 
33
 
32
     /**
34
     /**
33
      * @param input a string to be manipulated
35
      * @param input a string to be manipulated
34
      * @return the first 3 characters of `input`
36
      * @return the first 3 characters of `input`
35
      */
37
      */
36
-    public static String getPrefix(String input){
37
-        return null;
38
+    public static String getPrefix(String input) {
39
+        return input.substring(0, 3);
38
     }
40
     }
39
 
41
 
40
     /**
42
     /**
41
      * @param input a string to be manipulated
43
      * @param input a string to be manipulated
42
      * @return the last 3 characters of `input`
44
      * @return the last 3 characters of `input`
43
      */
45
      */
44
-    public static String getSuffix(String input){
45
-        return null;
46
+    public static String getSuffix(String input) {
47
+        return input.substring(input.length() - 3);
46
     }
48
     }
47
 
49
 
48
     /**
50
     /**
49
-     * @param inputValue the value to be compared
51
+     * @param inputValue      the value to be compared
50
      * @param comparableValue the value to be compared against
52
      * @param comparableValue the value to be compared against
51
      * @return the equivalence of two strings, `inputValue` and `comparableValue`
53
      * @return the equivalence of two strings, `inputValue` and `comparableValue`
52
      */
54
      */
53
-    public static Boolean compareTwoStrings(String inputValue, String comparableValue){
54
-        return null;
55
+    public static Boolean compareTwoStrings(String inputValue, String comparableValue) {
56
+        return inputValue.equals(comparableValue);
57
+
55
     }
58
     }
56
 
59
 
57
     /**
60
     /**
58
      * @param inputValue the value input from user
61
      * @param inputValue the value input from user
59
      * @return the middle character of `inputValue`
62
      * @return the middle character of `inputValue`
60
      */
63
      */
61
-    public static Character getMiddleCharacter(String inputValue){
62
-        return null;
64
+    public static Character getMiddleCharacter(String inputValue) {
65
+        double mid = inputValue.length() / 2;
66
+        int i = (int) mid;
67
+        if (inputValue.length() % 2 != 0) {
68
+            return inputValue.charAt(i);
69
+        } else {
70
+            return inputValue.charAt(i - 1);
71
+        }
63
     }
72
     }
64
 
73
 
65
     /**
74
     /**
66
      * @param spaceDelimitedString a string, representative of a sentence, containing spaces
75
      * @param spaceDelimitedString a string, representative of a sentence, containing spaces
67
      * @return the first sequence of characters
76
      * @return the first sequence of characters
68
      */
77
      */
69
-    public static String getFirstWord(String spaceDelimitedString){
70
-        return null;
78
+    public static String getFirstWord(String spaceDelimitedString) {
79
+        String [] stringArray = spaceDelimitedString.split(" ", 0);
80
+        return stringArray[0];
71
     }
81
     }
72
 
82
 
73
     /**
83
     /**
74
      * @param spaceDelimitedString a string delimited by spaces
84
      * @param spaceDelimitedString a string delimited by spaces
75
      * @return the second word of a string delimited by spaces.
85
      * @return the second word of a string delimited by spaces.
76
      */
86
      */
77
-    public static String getSecondWord(String spaceDelimitedString){
78
-        return null;
87
+    public static String getSecondWord(String spaceDelimitedString) {
88
+        String [] stringArray2 = spaceDelimitedString.split(" ",0);
89
+        return stringArray2[1];
79
     }
90
     }
80
 
91
 
81
     /**
92
     /**
82
      * @param stringToReverse
93
      * @param stringToReverse
83
      * @return an identical string with characters in reverse order.
94
      * @return an identical string with characters in reverse order.
84
      */
95
      */
85
-    public static String reverseTheTwo(String stringToReverse){
86
-        return null;
96
+    public static String reverseTheTwo(String stringToReverse) {
97
+        StringBuilder string1 = new StringBuilder(stringToReverse);
98
+
99
+        String string2 = string1.reverse().toString();
100
+
101
+        return String.valueOf(string2);
102
+        }
103
+
87
     }
104
     }
88
-}
105
+

+ 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
 }

+ 5
- 5
src/test/java/com/zipcodewilmington/danny_do_better_exercises/TestMathUtilities.java View File

36
         // : Given
36
         // : Given
37
         short baseValue = 16384;
37
         short baseValue = 16384;
38
         short addedValue = 7;
38
         short addedValue = 7;
39
-        short expected = 32767;
39
+        short expected = 16391;
40
         // : When
40
         // : When
41
         short actual = primativeTypes.add(baseValue, addedValue);
41
         short actual = primativeTypes.add(baseValue, addedValue);
42
         // : Then
42
         // : Then
146
         // : When
146
         // : When
147
         float actualFloat = primativeTypes.subtract(baseValue,difference);
147
         float actualFloat = primativeTypes.subtract(baseValue,difference);
148
         // : Then
148
         // : Then
149
-        assertEquals(expectedFloat,actualFloat, 0);
149
+        assertEquals(expectedFloat,actualFloat, 0.003);
150
     }
150
     }
151
     @Test
151
     @Test
152
     public void testSubtractions5() {
152
     public void testSubtractions5() {
294
     @Test
294
     @Test
295
     public void testMultiplication3() {
295
     public void testMultiplication3() {
296
         // : Given
296
         // : Given
297
-        byte multiplicand = 16;
298
-        byte multiplier = 14;
299
-        byte expectedByte = 64;
297
+        byte multiplicand = -8;
298
+        byte multiplier = 4;
299
+        byte expectedByte = -32;
300
         // : When
300
         // : When
301
         byte actualByte = primativeTypes.multiply(multiplicand, multiplier);
301
         byte actualByte = primativeTypes.multiply(multiplicand, multiplier);
302
         // : Then
302
         // : Then

+ 3
- 3
src/test/java/com/zipcodewilmington/danny_do_better_exercises/TestPredicateUtilities.java View File

33
         boolean outcome = math.isGreaterThan(greaterValue, lesserValue);
33
         boolean outcome = math.isGreaterThan(greaterValue, lesserValue);
34
 
34
 
35
         // : Then
35
         // : Then
36
-        assertTrue(outcome);
36
+        assertFalse(outcome);
37
     }
37
     }
38
 
38
 
39
 
39
 
62
         boolean outcome = math.isLessThan(greaterValue, lesserValue);
62
         boolean outcome = math.isLessThan(greaterValue, lesserValue);
63
 
63
 
64
         // : Then
64
         // : Then
65
-        assertTrue(outcome);
65
+        assertFalse(outcome);
66
     }
66
     }
67
 
67
 
68
 
68
 
116
         boolean outcome = math.isGreaterThanOrEqualTo(greaterValue, lesserValue);
116
         boolean outcome = math.isGreaterThanOrEqualTo(greaterValue, lesserValue);
117
 
117
 
118
         // : Then
118
         // : Then
119
-        assertTrue(outcome);
119
+        assertFalse(outcome);
120
     }
120
     }
121
 }
121
 }

+ 17
- 15
src/test/java/com/zipcodewilmington/danny_do_better_exercises/TestStringUtilities.java View File

22
     }
22
     }
23
 
23
 
24
     @Test
24
     @Test
25
-    public void concatenationStringTest(){
25
+    public void concatenationStringTest() {
26
         // : Given
26
         // : Given
27
         String one = "Hello";
27
         String one = "Hello";
28
         String two = " Java";
28
         String two = " Java";
29
         String expected = "Hello Java";
29
         String expected = "Hello Java";
30
 
30
 
31
         // : When
31
         // : When
32
-        String actual = StringUtilities.concatenation(one,two);
32
+        String actual = StringUtilities.concatenation(one, two);
33
 
33
 
34
 
34
 
35
         // : Then
35
         // : Then
38
 
38
 
39
 
39
 
40
     @Test
40
     @Test
41
-    public void concatenationStringAndIntegerTest(){
41
+    public void concatenationStringAndIntegerTest() {
42
         // : Given
42
         // : Given
43
         int one = 1;
43
         int one = 1;
44
         String two = " Java";
44
         String two = " Java";
45
         String expected = "1 Java";
45
         String expected = "1 Java";
46
 
46
 
47
         // : When
47
         // : When
48
-        String actual = StringUtilities.concatenation(one,two);
48
+        String actual = StringUtilities.concatenation(one, two);
49
 
49
 
50
 
50
 
51
         // : Then
51
         // : Then
53
     }
53
     }
54
 
54
 
55
     @Test
55
     @Test
56
-    public void substringBeginTest(){
56
+    public void substringBeginTest() {
57
         // : Given
57
         // : Given
58
         String input = "Hello";
58
         String input = "Hello";
59
-        String expected = "olleH";
59
+        String expected = "Hel";
60
 
60
 
61
         // : When
61
         // : When
62
         String actual = StringUtilities.getPrefix(input);
62
         String actual = StringUtilities.getPrefix(input);
66
     }
66
     }
67
 
67
 
68
     @Test
68
     @Test
69
-    public void substringEndTest(){
69
+    public void substringEndTest() {
70
         // : Given
70
         // : Given
71
         String input = "Hello";
71
         String input = "Hello";
72
         String expected = "llo";
72
         String expected = "llo";
79
     }
79
     }
80
 
80
 
81
     @Test
81
     @Test
82
-    public void compareToTestEquals(){
82
+    public void compareToTestEquals() {
83
         // : Given
83
         // : Given
84
         String inputValue = "Zipcode";
84
         String inputValue = "Zipcode";
85
         String comparableValue = "Zipcode";
85
         String comparableValue = "Zipcode";
93
 
93
 
94
 
94
 
95
     @Test
95
     @Test
96
-    public void compareToTestNotEquals(){
96
+    public void compareToTestNotEquals() {
97
         // : Given
97
         // : Given
98
         String inputValue = "Zipcode";
98
         String inputValue = "Zipcode";
99
         String comparableValue = "Zipcodee";
99
         String comparableValue = "Zipcodee";
106
     }
106
     }
107
 
107
 
108
     @Test
108
     @Test
109
-    public void getTheMiddleChar1(){
109
+    public void getTheMiddleChar1() {
110
         // : Given
110
         // : Given
111
         String input = "Zipcode";
111
         String input = "Zipcode";
112
         char expected = 'c';
112
         char expected = 'c';
120
 
120
 
121
 
121
 
122
     @Test
122
     @Test
123
-    public void getTheMiddleChar2(){
123
+    public void getTheMiddleChar2() {
124
         // : Given
124
         // : Given
125
         String input = "Zipcoder";
125
         String input = "Zipcoder";
126
         Character expected = 'c';
126
         Character expected = 'c';
134
 
134
 
135
 
135
 
136
     @Test
136
     @Test
137
-    public void getTheFirstWord(){
137
+    public void getTheFirstWord() {
138
         // : Given
138
         // : Given
139
         String input = "Zipcode Wilmington";
139
         String input = "Zipcode Wilmington";
140
         String expected = "Zipcode";
140
         String expected = "Zipcode";
148
 
148
 
149
 
149
 
150
     @Test
150
     @Test
151
-    public void getTheSecondWord(){
151
+    public void getTheSecondWord() {
152
         // : Given
152
         // : Given
153
         String input = "Zipcode Wilmington";
153
         String input = "Zipcode Wilmington";
154
         String expected = "Wilmington";
154
         String expected = "Wilmington";
155
 
155
 
156
         // : When
156
         // : When
157
-        String actual = StringUtilities.getFirstWord(input);
157
+        String actual = StringUtilities.getSecondWord(input);
158
 
158
 
159
         // : Then
159
         // : Then
160
         assertEquals(expected, actual);
160
         assertEquals(expected, actual);
161
     }
161
     }
162
-
163
     @Test
162
     @Test
164
     public void reverseThem(){
163
     public void reverseThem(){
165
         // : Given
164
         // : Given
174
         assertEquals(expected, actual);
173
         assertEquals(expected, actual);
175
     }
174
     }
176
 }
175
 }
176
+
177
+
178
+

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


BIN
target/test-classes/com/zipcodewilmington/danny_do_better_exercises/TestMathUtilities.class View File


BIN
target/test-classes/com/zipcodewilmington/danny_do_better_exercises/TestPredicateUtilities.class View File


BIN
target/test-classes/com/zipcodewilmington/danny_do_better_exercises/TestStringUtilities.class View File