Przeglądaj źródła

DevomerSnoitulos

Leon 6 lat temu
rodzic
commit
86edb5a68a

+ 5
- 0
README-NumberUtilities.md Wyświetl plik

@@ -12,6 +12,11 @@
12 12
 
13 13
 
14 14
 
15
+
16
+
17
+
18
+
19
+
15 20
 ## `String getRange(int stop)`
16 21
 * **Description**
17 22
     * Given an integer, `stop`, return a `String` concatenation of all values between `0` and `stop` exclusively.

+ 5
- 15
src/main/java/io/zipcoder/microlabs/mastering_loops/NumberUtilities.java Wyświetl plik

@@ -3,36 +3,26 @@ package io.zipcoder.microlabs.mastering_loops;
3 3
 
4 4
 public class NumberUtilities {
5 5
     public static String getEvenNumbers(int start, int stop) {
6
-        int offset = start % 2 != 0 ? 0 : 1;
7
-        return getRange(start+offset, stop, 2);
6
+        return null;
8 7
     }
9 8
 
10 9
 
11 10
     public static String getOddNumbers(int start, int stop) {
12
-        int offset = start % 2 == 0 ? 0 : 1;
13
-        return getRange(start+offset, stop, 2);
11
+        return null;
14 12
     }
15 13
 
16 14
 
17 15
     public static String getSquareNumbers(int start, int stop, int step) {
18
-        return getExponentiations(start, stop, step, 2);
16
+        return null;
19 17
     }
20 18
 
21 19
 
22 20
     public static String getRange(int start, int stop, int step) {
23
-        String result = "";
24
-        for (int i = start; i < stop; i += step) {
25
-            result += i;
26
-        }
27
-        return result;
21
+        return null;
28 22
     }
29 23
 
30 24
 
31 25
     public static String getExponentiations(int start, int stop, int step, int exponent) {
32
-        String result = "";
33
-        for (int i = start; i < stop; i += step) {
34
-            result += (int) Math.pow(i, exponent);
35
-        }
36
-        return result;
26
+        return null;
37 27
     }
38 28
 }

+ 3
- 10
src/main/java/io/zipcoder/microlabs/mastering_loops/TableUtilities.java Wyświetl plik

@@ -2,21 +2,14 @@ package io.zipcoder.microlabs.mastering_loops;
2 2
 
3 3
 public class TableUtilities {
4 4
     public static String getSmallMultiplicationTable() {
5
-        return getMultiplicationTable(5);
5
+        return null;
6 6
     }
7 7
 
8 8
     public static String getLargeMultiplicationTable() {
9
-        return getMultiplicationTable(10);
9
+        return null;
10 10
     }
11 11
 
12 12
     public static String getMultiplicationTable(int tableSize) {
13
-        String result = "";
14
-        for (int i = 1; i <= tableSize; i++) {
15
-            for (int j = 1; j <= tableSize; j++) {
16
-                result += String.format("%3d |", i * j);
17
-            }
18
-            result += "\n";
19
-        }
20
-        return result;
13
+        return null;
21 14
     }
22 15
 }

+ 4
- 13
src/main/java/io/zipcoder/microlabs/mastering_loops/TriangleUtilities.java Wyświetl plik

@@ -3,27 +3,18 @@ package io.zipcoder.microlabs.mastering_loops;
3 3
 public class TriangleUtilities {
4 4
 
5 5
     public static String getTriangle(int numberOfRows) {
6
-        String result = "";
7
-        for(int i=1; i<numberOfRows; i++) {
8
-            result += getRow(i) + "\n";
9
-        }
10
-        return result;
6
+        return null;
11 7
     }
12 8
 
13 9
     public static String getRow(int numberOfStars) {
14
-        String result = "";
15
-        for(int k=0; k<numberOfStars; k++) {
16
-            result += "*";
17
-        }
18
-        return result;
10
+        return null;
19 11
     }
20 12
 
21 13
     public static String getSmallTriangle() {
22
-        return getTriangle(5);
14
+        return null;
23 15
     }
24 16
 
25
-
26 17
     public static String getLargeTriangle() {
27
-        return getTriangle(10);
18
+        return null;
28 19
     }
29 20
 }