From b3a191446b335bad4a7bfacc24259f642bb8f34b Mon Sep 17 00:00:00 2001 From: ryanrmills Date: Mon, 7 Apr 2025 11:44:35 -0700 Subject: [PATCH 1/5] completed printItems method --- src/Practice.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Practice.java b/src/Practice.java index 89acfd9..5a40df5 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 da5c641775c29a978ca22545a2fa9cb8385a1abc Mon Sep 17 00:00:00 2001 From: ryanrmills Date: Mon, 7 Apr 2025 11:45:57 -0700 Subject: [PATCH 2/5] completed moreThanDouble method --- src/Practice.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Practice.java b/src/Practice.java index 5a40df5..613ff6d 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -48,6 +48,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 > b*2){ + return true; + } return false; } From 1877b1db013a4589d3a24a68f64a60bfe0480952 Mon Sep 17 00:00:00 2001 From: ryanrmills Date: Mon, 7 Apr 2025 11:48:45 -0700 Subject: [PATCH 3/5] completed allStartWithA method --- src/Practice.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index 613ff6d..849f51c 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 (String word : words){ + String lWord = word.toLowerCase(); + if (lWord.charAt(0) != 'a'){ + return false; + } + } + return true; } public static void main(String[] args) { From 9773fd8956db8f37e064305f96d26f3c931d8116 Mon Sep 17 00:00:00 2001 From: ryanrmills Date: Mon, 7 Apr 2025 11:51:20 -0700 Subject: [PATCH 4/5] compiled Practice.java --- src/Practice.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Practice.java b/src/Practice.java index 849f51c..1aea2db 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -77,6 +77,11 @@ 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! + //edge case + if (words.length < 1){ + return false; + } + for (String word : words){ String lWord = word.toLowerCase(); if (lWord.charAt(0) != 'a'){ From e4fb2de0feb186c0f395e7251be12df76ec8b894 Mon Sep 17 00:00:00 2001 From: ryanrmills Date: Mon, 7 Apr 2025 14:03:53 -0700 Subject: [PATCH 5/5] made moreThanDouble less wordy --- src/Practice.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Practice.java b/src/Practice.java index 1aea2db..30b62d1 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -48,10 +48,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! - if (a > b*2){ - return true; - } - return false; + // if (a > b*2){ + // return true; + // } + // return false; + + return a > b*2; }