Seth 6 년 전
부모
커밋
06bffd2346

+ 6
- 1
src/main/java/rocks/zipcode/io/quiz3/arrays/WaveGenerator.java 파일 보기

@@ -5,6 +5,11 @@ package rocks.zipcode.io.quiz3.arrays;
5 5
  */
6 6
 public class WaveGenerator {
7 7
     public static String[] wave(String str) {
8
-        return null;
8
+        String[] wave =new String[str.length()];
9
+        char[] charArray = str.toCharArray();
10
+        for (int i = 0; i < str.length(); i++){
11
+
12
+        }
13
+        return wave;
9 14
     }
10 15
 }

+ 3
- 2
src/main/java/rocks/zipcode/io/quiz3/fundamentals/StringUtils.java 파일 보기

@@ -5,8 +5,9 @@ package rocks.zipcode.io.quiz3.fundamentals;
5 5
  */
6 6
 public class StringUtils {
7 7
     public static String capitalizeNthCharacter(String str, Integer indexToCapitalize) {
8
-        Character.toUpperCase(str.charAt(indexToCapitalize));
9
-        return str;
8
+        StringBuilder builder = new StringBuilder(str);
9
+        builder.setCharAt(indexToCapitalize, Character.toUpperCase(str.charAt(indexToCapitalize)));
10
+        return builder.toString();
10 11
     }
11 12
 
12 13
     public static Boolean isCharacterAtIndex(String baseString, Character characterToCheckFor, Integer indexOfString) {

+ 3
- 4
src/main/java/rocks/zipcode/io/quiz3/generics/ArrayUtility.java 파일 보기

@@ -1,6 +1,8 @@
1 1
 package rocks.zipcode.io.quiz3.generics;
2 2
 
3
+import java.util.ArrayList;
3 4
 import java.util.Arrays;
5
+import java.util.List;
4 6
 import java.util.function.Function;
5 7
 
6 8
 /**
@@ -33,9 +35,6 @@ public class ArrayUtility<SomeType> {
33 35
     }
34 36
 
35 37
     public SomeType[] filter(Function<SomeType, Boolean> predicate) {
36
-
37
-       return Arrays.stream(array)
38
-               .map(predicate)
39
-               .toArray(SomeType[].class.::new);
38
+        return null;
40 39
     }
41 40
 }

+ 21
- 3
src/main/java/rocks/zipcode/io/quiz3/objectorientation/enums/RockPaperScissorHandSign.java 파일 보기

@@ -4,13 +4,31 @@ package rocks.zipcode.io.quiz3.objectorientation.enums;
4 4
  * @author leon on 09/12/2018.
5 5
  */
6 6
 public enum RockPaperScissorHandSign {
7
-    ADD_ENUMERATIONS_HERE;
7
+    ROCK,
8
+    PAPER,
9
+    SCISSORS;
8 10
 
9 11
     public RockPaperScissorHandSign getWinner() {
10
-        return null;
12
+        if (this.equals(PAPER)){
13
+            return SCISSORS;
14
+        } else if(this.equals(ROCK)){
15
+            return PAPER;
16
+        } else if (this.equals(SCISSORS)) {
17
+            return ROCK;
18
+        } else{
19
+            return null;
20
+        }
11 21
     }
12 22
 
13 23
     public RockPaperScissorHandSign getLoser() {
14
-        return null;
24
+        if (this.equals(PAPER)){
25
+            return ROCK;
26
+        } else if(this.equals(ROCK)){
27
+            return SCISSORS;
28
+        } else if (this.equals(SCISSORS)){
29
+            return PAPER;
30
+        } else {
31
+            return null;
32
+        }
15 33
     }
16 34
 }

+ 1
- 0
src/test/java/rocks/zipcode/io/quiz3/objectorientation/enums/labstatus/TestEnumerations.java 파일 보기

@@ -7,6 +7,7 @@ import rocks.zipcode.io.quiz3.objectorientation.enums.LabStatus;
7 7
  * @author leon on 10/12/2018.
8 8
  */
9 9
 public class TestEnumerations {
10
+
10 11
     @Test
11 12
     public void test1() {
12 13
         LabStatus.valueOf("COMPLETED");

+ 1
- 1
src/test/java/rocks/zipcode/io/quiz3/objectorientation/enums/rockpaperscissors/ScissorTest.java 파일 보기

@@ -13,7 +13,7 @@ public class ScissorTest {
13 13
     @Test
14 14
     public void setup() {
15 15
         // given
16
-        this.sign = RockPaperScissorHandSign.valueOf("SCISSOR");
16
+        this.sign = RockPaperScissorHandSign.valueOf("SCISSORS");
17 17
     }
18 18
 
19 19