From 2db7ce020241e05da4264df96a08691ff9f3b821 Mon Sep 17 00:00:00 2001 From: Akai <161771111+Akaiokaa@users.noreply.github.com> Date: Tue, 8 Apr 2025 09:42:48 -0700 Subject: [PATCH 1/3] The method for printItems is completed --- src/Practice.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Practice.java b/src/Practice.java index 89acfd9..db42f20 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -18,6 +18,9 @@ public class Practice { */ public static void printItems(String[] items) { // TODO: Implement this method here! + for(String item: items){ + System.out.println(item); + } } /** From d6623447cf576b1f18fa1cd9f7d75e52ef4084c5 Mon Sep 17 00:00:00 2001 From: Akai <161771111+Akaiokaa@users.noreply.github.com> Date: Tue, 8 Apr 2025 09:55:50 -0700 Subject: [PATCH 2/3] The method for moreThanDouble has been completed --- src/Practice.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index db42f20..d6a9d84 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -48,7 +48,11 @@ 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; + boolean tracker = false; + if(a > b*2){ + tracker = true; + } + return tracker; } From 766ec57e593b38f009c44b8005029c04d458ae25 Mon Sep 17 00:00:00 2001 From: Akai <161771111+Akaiokaa@users.noreply.github.com> Date: Tue, 8 Apr 2025 10:59:59 -0700 Subject: [PATCH 3/3] The last method of allStartWithA is complete --- src/Practice.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index d6a9d84..40855f0 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -76,9 +76,21 @@ public static boolean moreThanDouble(int a, int b) { * @param words a array of words * @return true if every word starts with A (case-insensitive), false otherwise. */ + //javac src/Practice.java && java -cp src Practice public static boolean allStartWithA(String[] words) { // TODO: Delete the dummy return statement and implement this method here! - return false; + boolean checker = false; + // System.out.println(words.length); + int temp = 0; + for (String string : words) { + if (String.valueOf(string.charAt(0)).toLowerCase().equals("a")) { + temp++; + } + } + if (temp == words.length) { + checker = true; + } + return checker; } public static void main(String[] args) {