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..1243ee2 100644 --- a/src/main/java/io/zipcoder/microlabs/mastering_loops/NumberUtilities.java +++ b/src/main/java/io/zipcoder/microlabs/mastering_loops/NumberUtilities.java @@ -3,26 +3,56 @@ public class NumberUtilities { public static String getEvenNumbers(int start, int stop) { - return null; + StringBuilder evenString = new StringBuilder(); + if (start % 2 == 0) { + for (int i = start; i < stop; i++){ + evenString.append(i); + } + } + return evenString.toString(); } public static String getOddNumbers(int start, int stop) { - return null; + StringBuilder oddString = new StringBuilder(); + if (start % 2 == 1) { + for (int i = start; i < stop; i++){ + oddString.append(i); + } + } + return oddString.toString(); } public static String getSquareNumbers(int start, int stop, int step) { - return null; - } + StringBuilder squareString = new StringBuilder(); + + for (int i = start; i < stop; i++){ + squareString.append(i*i); + } + return squareString.toString(); + } + + public static String getRange(int start, int stop, int step) { - return null; - } + StringBuilder range = new StringBuilder(); + for (int i = start; i