diff --git a/README.md b/README.md index c26c1eb..e624bcd 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ allStartWithA(new String[]{}): true ``` -Note that getting the correct output does NOT guarantee that your code is fully working. It is your resposibility to work on your code to make sure it works for all cases, not just the sample test cases provided. +Note that getting the correct output does NOT guarantee that your code is fully working. It is your responsibility to work on your code to make sure it works for all cases, not just the sample test cases provided. ## Submitting Make a pull request (PR) against the original repository and submit the URL to your PR on Canvas. diff --git a/src/Practice.java b/src/Practice.java index c83a376..4680a3f 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -17,7 +17,9 @@ public class Practice { * @param items an array of strings to print */ public static void printItems(String[] items) { - // TODO: Implement this method here! + for (String item : items) { + System.out.println(item); + } } /** @@ -44,8 +46,8 @@ public static void printItems(String[] items) { * @return true if a is strictly more than twice the value of b, false otherwise */ public static boolean moreThanDouble(int a, int b) { - // TODO: Delete the dummy return statement and implement this method here! - return false; + b = b * 2; + return a > b; } @@ -70,8 +72,13 @@ public static boolean moreThanDouble(int a, int b) { * @return true if every word starts with A (case-insensitive), false otherwise. */ public static boolean allStartWithA(String[] words) { - // TODO: Delete the dummy return statement and implement this method here! - return false; + for (String word : words) { + word = word.toLowerCase(); + if (!word.startsWith("a")) { + return false; + } + } + return true; } public static void main(String[] args) {