From 3be3211ca78fb2552a865cca872458ae241966a0 Mon Sep 17 00:00:00 2001 From: Owen Murphy Date: Fri, 9 Feb 2018 18:08:30 -0500 Subject: [PATCH 1/4] Puuuush --- .../mastering_loops/NumberUtilities.java | 80 +++++++++++++++++-- .../mastering_loops/NumberUtilitiesTest.java | 4 +- 2 files changed, 75 insertions(+), 9 deletions(-) diff --git a/src/main/java/io/zipcoder/microlabs/mastering_loops/NumberUtilities.java b/src/main/java/io/zipcoder/microlabs/mastering_loops/NumberUtilities.java index 5a742c4..fc5d786 100644 --- a/src/main/java/io/zipcoder/microlabs/mastering_loops/NumberUtilities.java +++ b/src/main/java/io/zipcoder/microlabs/mastering_loops/NumberUtilities.java @@ -2,27 +2,93 @@ public class NumberUtilities { + public static String getEvenNumbers(int start, int stop) { - return null; - } - public static String getOddNumbers(int start, int stop) { - return null; + String n = ""; + + for (int i = start; i Date: Sat, 10 Feb 2018 17:18:25 -0500 Subject: [PATCH 2/4] sunday --- .../mastering_loops/TriangleUtilities.java | 68 +++++++++++++++++-- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/zipcoder/microlabs/mastering_loops/TriangleUtilities.java b/src/main/java/io/zipcoder/microlabs/mastering_loops/TriangleUtilities.java index 0c7cd35..6b08136 100644 --- a/src/main/java/io/zipcoder/microlabs/mastering_loops/TriangleUtilities.java +++ b/src/main/java/io/zipcoder/microlabs/mastering_loops/TriangleUtilities.java @@ -3,18 +3,78 @@ public class TriangleUtilities { public static String getTriangle(int numberOfRows) { - return null; + + StringBuilder outcome = new StringBuilder(); + + + for (int i=1; i < numberOfRows; i++) { + + for (int j=0; j < i; j++){ + + outcome.append("*"); + } + outcome.append("\n"); + + } + + + return outcome.toString(); } public static String getRow(int numberOfStars) { - return null; + + StringBuilder outcome = new StringBuilder(); + + + for (int i=0; i < numberOfStars; i++){ + + outcome.append("*"); + + } + + + return outcome.toString(); } public static String getSmallTriangle() { - return null; + StringBuilder outcome = new StringBuilder(); + + + for (int i=1; i <=4; i++) { + + for (int j=0; j < i; j++){ + + outcome.append("*"); + } + outcome.append("\n"); + + } + + + return outcome.toString(); + + + } public static String getLargeTriangle() { - return null; + + StringBuilder outcome = new StringBuilder(); + + + for (int i=1; i <=9; i++) { + + for (int j=0; j < i; j++){ + + outcome.append("*"); + } + outcome.append("\n"); + + } + + + return outcome.toString(); + + } } From de106b7ce6b4235e3b7cc8593ff8db03f85ecc2c Mon Sep 17 00:00:00 2001 From: Owen Murphy Date: Mon, 12 Feb 2018 10:40:18 -0500 Subject: [PATCH 3/4] plug'n --- .../mastering_loops/TableUtilities.java | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/zipcoder/microlabs/mastering_loops/TableUtilities.java b/src/main/java/io/zipcoder/microlabs/mastering_loops/TableUtilities.java index e27a826..3fe5f10 100644 --- a/src/main/java/io/zipcoder/microlabs/mastering_loops/TableUtilities.java +++ b/src/main/java/io/zipcoder/microlabs/mastering_loops/TableUtilities.java @@ -5,11 +5,36 @@ public static String getSmallMultiplicationTable() { return null; } + public static String getLargeMultiplicationTable() { - return null; + + StringBuilder theString = new StringBuilder(); + + for (int i = 1; i<11; i++) { + + for (int j = 1; j<11; j++) { + + theString.append(String.format("%3d |", i * j)); + } + theString.append("\n"); + } + return theString.toString(); } + public static String getMultiplicationTable(int tableSize) { - return null; + + StringBuilder theString = new StringBuilder(); + + for (int i = 1; i <= tableSize; i++) { + + for (int j = 1; j <= tableSize; j++) { + + theString.append(String.format("%3d |", i * j)); + } + theString.append("\n"); + } + return theString.toString(); + } -} +} \ No newline at end of file From 323448a3be7443bda280c87110a31e79cdee27da Mon Sep 17 00:00:00 2001 From: Owen Murphy Date: Mon, 12 Feb 2018 13:30:39 -0500 Subject: [PATCH 4/4] git git git --- .../mastering_loops/TableUtilities.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/zipcoder/microlabs/mastering_loops/TableUtilities.java b/src/main/java/io/zipcoder/microlabs/mastering_loops/TableUtilities.java index 3fe5f10..246ad79 100644 --- a/src/main/java/io/zipcoder/microlabs/mastering_loops/TableUtilities.java +++ b/src/main/java/io/zipcoder/microlabs/mastering_loops/TableUtilities.java @@ -2,9 +2,22 @@ public class TableUtilities { public static String getSmallMultiplicationTable() { - return null; - } + StringBuilder smt = new StringBuilder(); + + for (int i = 1; i <= 5; i++) { + for (int j = 1; j <= 5; j++) { + + int num = i * j; + + smt.append(String.format("%3d |", num)); + } + smt.append("\n"); + + } + String myTable = smt.toString(); + return myTable; + } public static String getLargeMultiplicationTable() {