Nuridalia.Hernandez 6 лет назад
Родитель
Сommit
1401c15a03

+ 5
- 0
src/main/java/rocks/zipcode/io/quiz3/arrays/WaveGenerator.java Просмотреть файл

5
  */
5
  */
6
 public class WaveGenerator {
6
 public class WaveGenerator {
7
     public static String[] wave(String str) {
7
     public static String[] wave(String str) {
8
+
9
+
10
+
11
+
12
+
8
         return null;
13
         return null;
9
     }
14
     }
10
 }
15
 }

+ 49
- 4
src/main/java/rocks/zipcode/io/quiz3/fundamentals/VowelUtils.java Просмотреть файл

5
  */
5
  */
6
 public class VowelUtils {
6
 public class VowelUtils {
7
     public static Boolean hasVowels(String word) {
7
     public static Boolean hasVowels(String word) {
8
-        return null;
8
+         char [] chars = word.toCharArray();
9
+
10
+        for(int i=0;i <word.length();i++){
11
+            if(isVowel(chars[i])){
12
+
13
+
14
+                return true;
15
+            }
16
+
17
+
18
+        }
19
+
20
+        return false;
9
     }
21
     }
10
 
22
 
11
     public static Integer getIndexOfFirstVowel(String word) {
23
     public static Integer getIndexOfFirstVowel(String word) {
12
-        return null;
24
+        char [] chars = word.toCharArray();
25
+        Integer result = null;
26
+        for ( int i =0 ; i <chars.length ; i++) {
27
+
28
+            if (isVowel(chars[i])){
29
+
30
+                result = i;
31
+                break;
32
+            }
33
+
34
+        }
35
+
36
+
37
+        return result ;
13
     }
38
     }
14
 
39
 
15
 
40
 
16
     public static Boolean startsWithVowel(String word) {
41
     public static Boolean startsWithVowel(String word) {
17
-        return null;
42
+
43
+            if((word.charAt(0) == 'A' ||
44
+                    (word.charAt(0) == 'E')  ||
45
+                    (word.charAt(0) == 'I') ||
46
+                    (word.charAt(0) == 'O') ||
47
+                    (word.charAt(0) == 'U'))){
48
+                return true;
49
+            }
50
+
51
+        return false;
18
     }
52
     }
19
 
53
 
20
     public static Boolean isVowel(Character character) {
54
     public static Boolean isVowel(Character character) {
21
-        return null;
55
+
56
+
57
+        if((Character.toLowerCase(character) == 'a') ||
58
+                (Character.toLowerCase(character )== 'e')  ||
59
+                (Character.toLowerCase(character) == 'i') ||
60
+                (Character.toLowerCase(character) == 'o') ||
61
+                ( Character.toLowerCase(character)  == 'u')) {
62
+            return true;
63
+        }
64
+
65
+return false;
66
+
22
     }
67
     }
23
 }
68
 }

+ 1
- 1
src/main/java/rocks/zipcode/io/quiz3/generics/ArrayUtility.java Просмотреть файл

1
 package rocks.zipcode.io.quiz3.generics;
1
 package rocks.zipcode.io.quiz3.generics;
2
 
2
 
3
 import java.util.function.Function;
3
 import java.util.function.Function;
4
-import java.util.stream.Collectors;
4
+
5
 
5
 
6
 /**
6
 /**
7
  * @author leon on 09/12/2018.
7
  * @author leon on 09/12/2018.

+ 2
- 2
src/test/java/rocks/zipcode/io/quiz3/fundamentals/stringutils/IsCharacterAtIndex.java Просмотреть файл

16
         Integer index = 0;
16
         Integer index = 0;
17
 
17
 
18
         // then
18
         // then
19
-        Assert.assertTrue(StringUtils.isCharacterAtIndex(string, character, index));
19
+        Assert.assertFalse(StringUtils.isCharacterAtIndex(string, character, index));
20
     }
20
     }
21
 
21
 
22
     @Test
22
     @Test
27
         Integer index = 0;
27
         Integer index = 0;
28
 
28
 
29
         // then
29
         // then
30
-        Assert.assertFalse(StringUtils.isCharacterAtIndex(string, character, index));
30
+        Assert.assertTrue(StringUtils.isCharacterAtIndex(string, character, index));
31
     }
31
     }
32
 
32
 
33
 
33