From 9d3add61917cf760b964e8653aab7889bbebbe8b Mon Sep 17 00:00:00 2001 From: Un01 <274392693+alexanderpena014-svg@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:30:41 -0700 Subject: [PATCH 1/6] started main method and added the print item lines inside it --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index c26c1eb..bb67c75 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,16 @@ This will compile your code and run the main method of the Practice class. Befor ``` +public static void main(String[] args) { + System.out.println("///// Print items /////"); + System.out.println("Calling printItems(new String[]{"welcome", "to", "cs", "123"})"); + printItem(new String[]{"welcome", "to", "cs", "123"}); + System.out.println(); + + System.out.println("Calling printItems(new String[]{\"hello\", \"world\"})"); + printItem(new String[]{"hello", "world"}); + System.out.println(); +} ///// Print items ///// Calling printItems(new String[]{"welcome", "to", "cs", "123"}) From f977cd5e08396413f6d721781aef5266cdaa6065 Mon Sep 17 00:00:00 2001 From: Un01 <274392693+alexanderpena014-svg@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:51:53 -0700 Subject: [PATCH 2/6] added the more than double into the main method --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index bb67c75..b6ba972 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,13 @@ public static void main(String[] args) { System.out.println("Calling printItems(new String[]{\"hello\", \"world\"})"); printItem(new String[]{"hello", "world"}); System.out.println(); + + System.out.println("///// More than Double /////"); + System.out.println("moreThanDouble(10, 3): " + moreThanDouble(10, 3)); + System.out.println("moreThanDouble(6, 4): " + moreThanDouble(6, 4)); + System.out.println("moreThanDouble(4, 2): " + moreThanDouble(4, 2)); + System.out.println(); + } ///// Print items ///// From ee47032159e433fef0232c66eabfc12d569aa089 Mon Sep 17 00:00:00 2001 From: Un01 <274392693+alexanderpena014-svg@users.noreply.github.com> Date: Sat, 11 Apr 2026 09:11:24 -0700 Subject: [PATCH 3/6] added the all start with a code line in main method --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index b6ba972..68039bc 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,10 @@ public static void main(String[] args) { System.out.println("moreThanDouble(4, 2): " + moreThanDouble(4, 2)); System.out.println(); + System.out.println("///// All Start With A /////"); + System.out.println(allStartWithA(new String[]{"alligators", "are", "AWESOME"})); + System.out.println(allStartWithA(new String[]{"apes", "can", "be", "amazing"})); + System.out.println(allStartWithA(new String[]{})); } ///// Print items ///// From 2a54538e711295b7af335bc02ff0b305dd45e636 Mon Sep 17 00:00:00 2001 From: Un01 <274392693+alexanderpena014-svg@users.noreply.github.com> Date: Sat, 11 Apr 2026 17:30:54 -0700 Subject: [PATCH 4/6] created the code to print each item on its own line --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 68039bc..14f1dfa 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,14 @@ public static void main(String[] args) { System.out.println(allStartWithA(new String[]{})); } +// Each item in the array prints on its own line +public static void printItems(String[] items) { + for (int i = 0; i < items.length; i++) { + System.out.println(items[i]); + } +} + + ///// Print items ///// Calling printItems(new String[]{"welcome", "to", "cs", "123"}) welcome From 0008063352c607c3947312ec986e2960da6a26a9 Mon Sep 17 00:00:00 2001 From: Un01 <274392693+alexanderpena014-svg@users.noreply.github.com> Date: Sat, 11 Apr 2026 17:51:20 -0700 Subject: [PATCH 5/6] Returns true if x is two times more than y --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 14f1dfa..c5bc914 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ javac src/Practice.java && java -cp src Practice This will compile your code and run the main method of the Practice class. Before you implement your solutions, the output will be INCORRECT (it will not print the messages on new lines and it will show false for everything). When you finish your solutions, the output should look like this: ``` - +// public static void main(String[] args) { System.out.println("///// Print items /////"); System.out.println("Calling printItems(new String[]{"welcome", "to", "cs", "123"})"); @@ -50,6 +50,15 @@ public static void printItems(String[] items) { } } +// Returns true if x is two times more than y +public static boolean moreThanDouble(int x, int y) { + if (x > 2 * y) { + return true; + } else { + return false; + } +} + ///// Print items ///// Calling printItems(new String[]{"welcome", "to", "cs", "123"}) From fc6f3f72c856e7a15f2cf50b1e0893e61bb3bd82 Mon Sep 17 00:00:00 2001 From: Un01 <274392693+alexanderpena014-svg@users.noreply.github.com> Date: Sat, 11 Apr 2026 17:57:23 -0700 Subject: [PATCH 6/6] Returns true if all strings start with the letters A or a --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index c5bc914..ffa68df 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,18 @@ public static boolean moreThanDouble(int x, int y) { } } +// Returns true if all strings start with A or a +public static boolean allStartWithA(String[] words) { + for (int i = 0; i < words.length; i++) { + String word = words[i]; + + if (!word.startsWith("a") && !word.startsWith("A")) { + return false; + } + } + return true; +} + ///// Print items ///// Calling printItems(new String[]{"welcome", "to", "cs", "123"})