浏览代码

Merge pull request #30 from Zipcoder/feat/leon

DevomerSnoitulos
Git-Leon 6 年前
父节点
当前提交
7dd8efd6dd
没有帐户链接到提交者的电子邮件

+ 1
- 0
README-NumberUtilities.md 查看文件

@@ -11,6 +11,7 @@
11 11
 
12 12
 
13 13
 
14
+
14 15
 <br><br><br><br>
15 16
 ## `String getRange(int stop)`
16 17
 * **Description**

+ 5
- 15
src/main/java/io/zipcoder/microlabs/mastering_loops/NumberUtilities.java 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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
 }