From 4146d6a94398e483d3492f3515603cb6e721d832 Mon Sep 17 00:00:00 2001 From: Kelley Castillo Date: Mon, 7 Apr 2025 13:41:41 -0700 Subject: [PATCH 1/3] Finished with method 1 --- src/Practice.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index 89acfd9..e748386 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -17,7 +17,8 @@ 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); } /** @@ -46,6 +47,12 @@ public static void printItems(String[] items) { public static boolean moreThanDouble(int a, int b) { // TODO: Delete the dummy return statement and implement this method here! return false; + if a double(b) { + return false; + } else { + return true; + } + } } From a2577a1dad6683103ce917fdc3478e8b0729e175 Mon Sep 17 00:00:00 2001 From: Kelley Castillo Date: Mon, 7 Apr 2025 13:44:17 -0700 Subject: [PATCH 2/3] finished with method 2 --- src/Practice.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/Practice.java b/src/Practice.java index e748386..b862218 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -46,13 +46,7 @@ public static void printItems(String[] items) { */ public static boolean moreThanDouble(int a, int b) { // TODO: Delete the dummy return statement and implement this method here! - return false; - if a double(b) { - return false; - } else { - return true; - } - } + return a > 2*b; } @@ -77,7 +71,6 @@ 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; } From 0a62288b0f0203aaa18d7fea97aad3bf2d69eee3 Mon Sep 17 00:00:00 2001 From: Kelley Castillo Date: Mon, 7 Apr 2025 14:01:47 -0700 Subject: [PATCH 3/3] finished with method 3 --- src/Practice.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Practice.java b/src/Practice.java index b862218..81383f6 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -45,7 +45,6 @@ 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 a > 2*b; } @@ -71,7 +70,15 @@ 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) { - return false; + if (words.length ==0) { + return true; + } + for(String word: words) { + if (word==null || word.isEmpty() || !word.toLowerCase().startsWith("a")) { + return false; + } + } + return true; } public static void main(String[] args) {