diff --git a/src/main/java/io/zipcoder/StringsAndThings.java b/src/main/java/io/zipcoder/StringsAndThings.java index 073467a..1a2fe04 100644 --- a/src/main/java/io/zipcoder/StringsAndThings.java +++ b/src/main/java/io/zipcoder/StringsAndThings.java @@ -15,7 +15,18 @@ public class StringsAndThings { * countYZ("day fyyyz"); // Should return 2 */ public Integer countYZ(String input){ - return null; + int letterCounter = 0; // we made a counter for the loop + String[] words = input.split(" "); // made a new string array, called words. made up of the string 'input'. split up based on spaces + for (String w: words) { // words = ["fez", "day"] + int n = w.length(); // made a new string called w. something with the array called words. for each value + if (w.charAt(n - 1) == 'Y' || w.charAt(n - 1) == 'Z') ; // of the array called words, we have a string called w. w is "fez", w is "day" + letterCounter++; // made an integer called n that is set to the length of the string w. (length of w is 3, for fez) + } // which comes from the values of the array called words + // if the character at the end of the string called w(the string "fez"), is equal to the char 'Y' + // or 'Z', increase the letter counter + // return the letter counter. + + return letterCounter; } /** @@ -27,7 +38,9 @@ public Integer countYZ(String input){ * removeString("Hello there", "e") // Should return "Hllo thr" * removeString("Hello there", "x") // Should return "Hello there" */ - public String removeString(String base, String remove){ + public String removeString(String base, String remove) { + + return null; } diff --git a/target/classes/io/zipcoder/StringsAndThings.class b/target/classes/io/zipcoder/StringsAndThings.class new file mode 100644 index 0000000..bc32e2c Binary files /dev/null and b/target/classes/io/zipcoder/StringsAndThings.class differ diff --git a/target/test-classes/io/zipcoder/stringsandthings/ContainsEqualNumberOfIsAndNotTest.class b/target/test-classes/io/zipcoder/stringsandthings/ContainsEqualNumberOfIsAndNotTest.class new file mode 100644 index 0000000..556ec64 Binary files /dev/null and b/target/test-classes/io/zipcoder/stringsandthings/ContainsEqualNumberOfIsAndNotTest.class differ diff --git a/target/test-classes/io/zipcoder/stringsandthings/CountTripleTest.class b/target/test-classes/io/zipcoder/stringsandthings/CountTripleTest.class new file mode 100644 index 0000000..29d3cfe Binary files /dev/null and b/target/test-classes/io/zipcoder/stringsandthings/CountTripleTest.class differ diff --git a/target/test-classes/io/zipcoder/stringsandthings/CountYZTest.class b/target/test-classes/io/zipcoder/stringsandthings/CountYZTest.class new file mode 100644 index 0000000..27178e4 Binary files /dev/null and b/target/test-classes/io/zipcoder/stringsandthings/CountYZTest.class differ diff --git a/target/test-classes/io/zipcoder/stringsandthings/GIsHappyTest.class b/target/test-classes/io/zipcoder/stringsandthings/GIsHappyTest.class new file mode 100644 index 0000000..97d69c0 Binary files /dev/null and b/target/test-classes/io/zipcoder/stringsandthings/GIsHappyTest.class differ diff --git a/target/test-classes/io/zipcoder/stringsandthings/RemoveStringTest.class b/target/test-classes/io/zipcoder/stringsandthings/RemoveStringTest.class new file mode 100644 index 0000000..715f4d3 Binary files /dev/null and b/target/test-classes/io/zipcoder/stringsandthings/RemoveStringTest.class differ