From 949fe23684c072e5fe61c9bf47a574307295a71a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Auberon=20L=C3=B3pez?= Date: Wed, 8 Apr 2026 08:36:40 -0700 Subject: [PATCH 1/8] Update directory name from sdev220 to cs123 --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 64cab1e..c26c1eb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Practice writing Java code and using git/GitHub. Complete the github-intro assignment before this one! ## Setup -Fork and clone this repository. Do not forget to fork before cloning! For a refresher on git/GitHub, see the instructions on the github-intro repository. You will not need to create a `sdev220` directory again, you can re-use the exisiting one you have already made. +Fork and clone this repository. Do not forget to fork before cloning! For a refresher on git/GitHub, see the instructions on the github-intro repository. You will not need to create a `cs123` directory again, you can re-use the exisiting one you have already made. ## **Commit Frequently!** To receive full credit **you MUST commit frequently** for this assignment. At the very least, make one commit after completing each method. Make sure to push after each commit! @@ -23,11 +23,11 @@ This will compile your code and run the main method of the Practice class. Befor ///// Print items ///// -Calling printItems(new String[]{"welcome", "to", "sdev", "220"}) +Calling printItems(new String[]{"welcome", "to", "cs", "123"}) welcome to -sdev -220 +cs +123 Calling printItems(new String[]{"hello", "world"}) hello From a8bf433022d61c5fcb6ad679802b7f07ba03be41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Auberon=20L=C3=B3pez?= Date: Wed, 8 Apr 2026 08:37:35 -0700 Subject: [PATCH 2/8] Update example input in Practice.java --- src/Practice.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Practice.java b/src/Practice.java index 89acfd9..e211a7f 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -6,7 +6,7 @@ public class Practice { * Example: * * input: - * {"welcome", "to", "sdev", "220"} + * {"welcome", "to", "cs", "123"} * * printed output: * welcome @@ -77,8 +77,8 @@ public static boolean allStartWithA(String[] words) { public static void main(String[] args) { System.out.println(); System.out.println("///// Print items /////"); - System.out.println("Calling printItems(new String[]{\"welcome\", \"to\", \"sdev\", \"220\"})"); - printItems(new String[]{"welcome", "to", "sdev", "220"}); + System.out.println("Calling printItems(new String[]{\"welcome\", \"to\", \"cs\", \"123\"})"); + printItems(new String[]{"welcome", "to", "cs", "123"}); System.out.println(); System.out.println("Calling printItems(new String[]{\"hello\", \"world\"})"); printItems(new String[]{"hello", "world"}); @@ -96,4 +96,4 @@ public static void main(String[] args) { System.out.println("allStartWithA(new String[]{}): " + allStartWithA(new String[]{})); System.out.println(); } -} \ No newline at end of file +} From cba12a281426e2470a26b75627249a7a84b49e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Auberon=20L=C3=B3pez?= Date: Wed, 8 Apr 2026 08:37:51 -0700 Subject: [PATCH 3/8] Update printed output in Practice.java comments --- src/Practice.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Practice.java b/src/Practice.java index e211a7f..c83a376 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -11,8 +11,8 @@ public class Practice { * printed output: * welcome * to - * sdev - * 220 + * cs + * 123 * * @param items an array of strings to print */ From e702112e225437f975011530edb20a109a263f01 Mon Sep 17 00:00:00 2001 From: uglybrecke <206612742+uglybrecke@users.noreply.github.com> Date: Fri, 10 Apr 2026 18:08:02 -0700 Subject: [PATCH 4/8] updated the printItems method with a simple for each loop to println each item --- src/Practice.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index c83a376..d6a0aa7 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -16,8 +16,12 @@ public class Practice { * * @param items an array of strings to print */ + public static void printItems(String[] items) { - // TODO: Implement this method here! + // goes down the items array and prints each item + for (String item : items) { + System.out.println(item); + } } /** From 948fc0e104a3f7f998e7ad07e17422d0d3ada1f0 Mon Sep 17 00:00:00 2001 From: uglybrecke <206612742+uglybrecke@users.noreply.github.com> Date: Fri, 10 Apr 2026 18:31:00 -0700 Subject: [PATCH 5/8] made the moreThanDouble method used a - b logic --- src/Practice.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Practice.java b/src/Practice.java index d6a0aa7..e726a00 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -48,8 +48,12 @@ 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 false; + int result = a - b; + if (result >= b) { + return true; + } else { + return false; + } } From fa8f2e62d0d7556d7ea124e0e621e9124db77ec5 Mon Sep 17 00:00:00 2001 From: uglybrecke <206612742+uglybrecke@users.noreply.github.com> Date: Fri, 10 Apr 2026 22:57:16 -0700 Subject: [PATCH 6/8] made the all start with a method after having to do research about specifics with characters, though i feel like there's a way to get it to compare as toLowerCase but i couldn't figure that out so i went with a tiny char array with both a's --- src/Practice.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Practice.java b/src/Practice.java index e726a00..e66c228 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -78,9 +78,22 @@ 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; - } + //check if array is empty + if (words.length <= 0 || words == null) { + return true; + } + char aCheck[] = {'a', 'A'}; + boolean verified = false; + for (String word : words) { + char first = word.charAt(0); //https://www.w3schools.com/java/ref_string_charat.asp + if (first == aCheck[0] || first == aCheck[1]) { + verified = true; + } else { + verified = false; + } + } + return verified; //for each loop should adjust verified + } public static void main(String[] args) { System.out.println(); From 578dafc1f5d8853ae4c3bb92a663a1e2359decc1 Mon Sep 17 00:00:00 2001 From: uglybrecke <206612742+uglybrecke@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:02:41 -0700 Subject: [PATCH 7/8] fixed an issue where allStartWithA didn't send false when it ran into word that started with something other than a in the middle of an array --- src/Practice.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index e66c228..40c6f11 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -89,7 +89,7 @@ public static boolean allStartWithA(String[] words) { if (first == aCheck[0] || first == aCheck[1]) { verified = true; } else { - verified = false; + return false; } } return verified; //for each loop should adjust verified From 083b7930ba1576e306876f52fca4880e5933f13b Mon Sep 17 00:00:00 2001 From: uglybrecke <206612742+uglybrecke@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:05:11 -0700 Subject: [PATCH 8/8] fixed and issue with the more than double method returning true when it was exactly double not only more than double --- src/Practice.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Practice.java b/src/Practice.java index 40c6f11..81d0d05 100644 --- a/src/Practice.java +++ b/src/Practice.java @@ -49,7 +49,7 @@ public static void printItems(String[] items) { */ public static boolean moreThanDouble(int a, int b) { int result = a - b; - if (result >= b) { + if (result > b) { return true; } else { return false;