Browse Source

Fundamentals minus PigLatinSentence

Nathan Hall 6 years ago
parent
commit
54c6ff6025

+ 8
- 1
src/main/java/rocks/zipcode/io/quiz3/arrays/TicTacToe.java View File

56
     }
56
     }
57
 
57
 
58
     public Boolean isRowHomogenous(Integer rowIndex) {
58
     public Boolean isRowHomogenous(Integer rowIndex) {
59
-        return null;
59
+
60
+        for (int i = 1; i < 3; i++) {
61
+            if (this.board[rowIndex][i] != this.board[rowIndex][i - 1]){
62
+                return false;
63
+            }
64
+        }
65
+
66
+        return true;
60
     }
67
     }
61
 
68
 
62
     public Boolean isColumnHomogeneous(Integer columnIndex) {
69
     public Boolean isColumnHomogeneous(Integer columnIndex) {

+ 2
- 16
src/main/java/rocks/zipcode/io/quiz3/arrays/WaveGenerator.java View File

14
                 s[i] = s[i].substring(0,i) + s[i].substring(i,i+1).toUpperCase() + s[i].substring(i+1);
14
                 s[i] = s[i].substring(0,i) + s[i].substring(i,i+1).toUpperCase() + s[i].substring(i+1);
15
             }
15
             }
16
         }
16
         }
17
+
18
+
17
         return s;
19
         return s;
18
     }
20
     }
19
 
21
 
20
 
22
 
21
-//        String big = "";
22
-//
23
-//        for (int j = 0; j < s.length; j++) {
24
-//            for (int i = 0; i < str.length() ; i++) {
25
-//                if (i == j){
26
-//                   // String.valueOf(s[j].charAt(j)).toUpperCase();
27
-//                    big = String.valueOf(s[j].charAt(j));
28
-//                    big.toUpperCase();
29
-//                    System.out.println(big);
30
-//                }
31
-//            }
32
-//        }
33
-//
34
-//        return s;
35
-
36
 
23
 
37
-//&& String.valueOf(s[j].charAt(i)).matches("[A-Za-z]")
38
 }
24
 }

+ 3
- 3
src/main/java/rocks/zipcode/io/quiz3/collections/Lab.java View File

11
         this.labName = labName;
11
         this.labName = labName;
12
         this.labStatus = labStatus;
12
         this.labStatus = labStatus;
13
     }
13
     }
14
-//    public Lab() {
15
-//        this(null);
16
-//    }
14
+    public Lab() {
15
+        this(null);
16
+    }
17
 
17
 
18
     public Lab(String labName) {
18
     public Lab(String labName) {
19
         this.labName = labName;
19
         this.labName = labName;

+ 6
- 1
src/main/java/rocks/zipcode/io/quiz3/collections/Student.java View File

37
 
37
 
38
 
38
 
39
     public void forkLab(Lab lab) {
39
     public void forkLab(Lab lab) {
40
+        this.lab = lab;
40
     }
41
     }
41
 
42
 
42
     public LabStatus getLabStatus(String labName) {
43
     public LabStatus getLabStatus(String labName) {
43
-        throw new UnsupportedOperationException("Method not yet implemented");
44
+        Student student = new Student();
45
+
46
+
47
+//        throw new UnsupportedOperationException("Method not yet implemented");
48
+        return student.getLabStatus(labName);
44
     }
49
     }
45
 }
50
 }

+ 19
- 1
src/main/java/rocks/zipcode/io/quiz3/fundamentals/PigLatinGenerator.java View File

5
  */
5
  */
6
 public class PigLatinGenerator {
6
 public class PigLatinGenerator {
7
     public String translate(String str) {
7
     public String translate(String str) {
8
-        return null;
8
+        String[] strArr = str.split(" ");
9
+        String newStr = "";
10
+        for (int i = 0; i < str.length(); i++) {
11
+           if( String.valueOf(str.charAt(i)).matches("[AEIOUaeiou]")){
12
+               if (i == 0){
13
+                   newStr = str + "way";
14
+                   i = str.length();
15
+
16
+               } else {
17
+                   newStr = str.substring(i) + str.substring(0, i) + "ay";
18
+                   i = str.length();
19
+               }
20
+           } else {
21
+               newStr = str + "ay";
22
+           }
23
+
24
+        }
25
+
26
+        return newStr;
9
     }
27
     }
10
 }
28
 }