From acb5bda42d85d5eaabe4a5dcc40603723c053ebe Mon Sep 17 00:00:00 2001 From: Iquer_Dough <206500499+DennysSaenz123@users.noreply.github.com> Date: Tue, 8 Apr 2025 20:52:27 -0700 Subject: [PATCH 1/4] Solved the first problem, used a for i loop --- src/Practice.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index 89acfd9..6524d1d 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -17,7 +17,7 @@ public class Practice { * @param items an array of strings to print */ public static void printItems(String[] items) { - // TODO: Implement this method here! + for() } /** From 9fe665e99237fbd3e00e68adac57f6c3571b55e9 Mon Sep 17 00:00:00 2001 From: Iquer_Dough <206500499+DennysSaenz123@users.noreply.github.com> Date: Tue, 8 Apr 2025 20:55:04 -0700 Subject: [PATCH 2/4] Forgot to save before completing first commit, now for loop should show --- src/Practice.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index 6524d1d..0789841 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) { - for() + for(int i = 0; i < items.length; i++){ + System.out.println(items[i]); + } } /** From 68813509db721d06d90c374bd91a3a65bb80856f Mon Sep 17 00:00:00 2001 From: Iquer_Dough <206500499+DennysSaenz123@users.noreply.github.com> Date: Wed, 9 Apr 2025 08:57:27 -0700 Subject: [PATCH 3/4] Solved second problem, used if statement to check is a is double b the returned true or false --- src/Practice.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index 0789841..61f0b4c 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -47,7 +47,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; + if( a > b * 2){ + return true + } else { + return false + } } From 6f2d566aa837b5cbce0c5e47a456df6df3f8bcb2 Mon Sep 17 00:00:00 2001 From: Iquer_Dough <206500499+DennysSaenz123@users.noreply.github.com> Date: Wed, 9 Apr 2025 09:09:29 -0700 Subject: [PATCH 4/4] Solved third problem, used for each loop and checked if array was empty or if the words did not start with a --- src/Practice.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index 61f0b4c..7b4bf02 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -77,7 +77,13 @@ 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(word: words){ + if(words.length == 0 || !word.toLowerCase().startsWith("a")){ + return false + } + } + return true ; + } } public static void main(String[] args) {