From 3ba0b7e7ead6b20eee5d9c796508c8749ae31657 Mon Sep 17 00:00:00 2001 From: annaliese_scott <274317330+annaliesescott@users.noreply.github.com> Date: Sun, 12 Apr 2026 21:43:15 -0700 Subject: [PATCH 1/5] created printItems method to use a for loop to isolate each item and S.O.P to print each item on a new line --- src/Practice.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index c83a376..64c08cc 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(int i=0; i Date: Sun, 12 Apr 2026 21:47:18 -0700 Subject: [PATCH 2/5] created moreThanDouble method by using an if statement to check if b is less than half of a, if yes return true, if no return false --- src/Practice.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Practice.java b/src/Practice.java index 64c08cc..4799c31 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -47,6 +47,9 @@ 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! + if(a/2 Date: Sun, 12 Apr 2026 21:56:11 -0700 Subject: [PATCH 3/5] created allStartWithA method by using a for loop to traverse to each word, cover edge case, the check if each word starts with a or A using if statement --- src/Practice.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index 4799c31..b5b0ac7 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -76,7 +76,18 @@ public static boolean moreThanDouble(int a, int b) { */ public static boolean allStartWithA(String[] words) { // TODO: Delete the dummy return statement and implement this method here! - return false; + for(int i=0; i Date: Sun, 12 Apr 2026 21:58:30 -0700 Subject: [PATCH 4/5] adjusted logic errors in method 2 and 3 --- src/Practice.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Practice.java b/src/Practice.java index b5b0ac7..72657c5 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -47,7 +47,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! - if(a/2b){ return true; } return false; @@ -80,7 +80,7 @@ public static boolean allStartWithA(String[] words) { if(words[i]==null){ return true; } - else if(words[i].charAt(1) == 'a' || words[i].charAt(1) == 'A'){ + else if(words[i].charAt(0) == 'a' || words[i].charAt(1) == 'A'){ continue; } else{ From 232f67a60d59a8a4239e6fcd7cdfcf44354c9577 Mon Sep 17 00:00:00 2001 From: annaliese_scott <274317330+annaliesescott@users.noreply.github.com> Date: Sun, 12 Apr 2026 22:00:57 -0700 Subject: [PATCH 5/5] adjusted else if loop in method 3 to use indexOf instead of charAt to hopefully fix error --- src/Practice.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index 72657c5..6180a2e 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -80,7 +80,7 @@ public static boolean allStartWithA(String[] words) { if(words[i]==null){ return true; } - else if(words[i].charAt(0) == 'a' || words[i].charAt(1) == 'A'){ + else if(words[i].indexOf("a") == 0|| words[i].indexOf("A") == 0){ continue; } else{