Owen Murphy 6 years ago
parent
commit
de106b7ce6

+ 28
- 3
src/main/java/io/zipcoder/microlabs/mastering_loops/TableUtilities.java View File

@@ -5,11 +5,36 @@ public class TableUtilities {
5 5
         return null;
6 6
     }
7 7
 
8
+
8 9
     public static String getLargeMultiplicationTable() {
9
-        return null;
10
+
11
+        StringBuilder theString = new StringBuilder();
12
+
13
+        for (int i = 1; i<11; i++) {
14
+
15
+            for (int j = 1; j<11; j++) {
16
+
17
+                theString.append(String.format("%3d |", i * j));
18
+            }
19
+            theString.append("\n");
20
+        }
21
+        return theString.toString();
10 22
     }
11 23
 
24
+
12 25
     public static String getMultiplicationTable(int tableSize) {
13
-        return null;
26
+
27
+        StringBuilder theString = new StringBuilder();
28
+
29
+        for (int i = 1; i <= tableSize; i++) {
30
+
31
+            for (int j = 1; j <= tableSize; j++) {
32
+
33
+                theString.append(String.format("%3d |", i * j));
34
+            }
35
+            theString.append("\n");
36
+        }
37
+        return theString.toString();
38
+
14 39
     }
15
-}
40
+}