diff --git a/src/Practice.java b/src/Practice.java index c83a376..730261d 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -17,9 +17,13 @@ public class Practice { * @param items an array of strings to print */ public static void printItems(String[] items) { - // TODO: Implement this method here! + for(int i = 0; i < items.length; i++) + { + System.out.println(items[i]); + } } + //test /** * Returns whether a is more than twice the value of b. * @@ -44,7 +48,7 @@ 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! + if(a > (b*2)){return true;} return false; } @@ -70,7 +74,21 @@ 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! + int counter = 0; + String tWord; + char tLet = 'a'; + for(int i = 0; i < words.length; i++) + { + tWord = words[i].toLowerCase(); + if(tWord.charAt(0) == tLet) + { + counter++; + } + } + if(words.length == counter) + { + return true; + } return false; }