|
@@ -1,8 +1,183 @@
|
1
|
1
|
# TableUtilities
|
|
2
|
+* Ensure each of the test cases in the class [TableUtilitiesTest]() successfully passes upon completion of each method stubs in the class [TableUtilities]().
|
|
3
|
+ * `String getLargeMultiplicationTable()`
|
|
4
|
+ * `String getSmallMultiplicationTable()`
|
|
5
|
+ * `String getMultiplicationTable(int width)`
|
2
|
6
|
|
3
|
|
-## `String tableSquare(int n)`
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+## `String getSmallMultiplicationTable()`
|
|
40
|
+* **Description**
|
|
41
|
+ * Generate a `String` representation of a multiplication table whose dimensions are `4` by `4`
|
|
42
|
+
|
|
43
|
+### Example 1
|
|
44
|
+* Sample Script
|
|
45
|
+
|
|
46
|
+ ```
|
|
47
|
+ // : Given
|
|
48
|
+ // : When
|
|
49
|
+ String outcome = TableUtilities.getSmallMultiplicationTable();
|
|
50
|
+
|
|
51
|
+ // : Then
|
|
52
|
+ System.out.println(outcome);
|
|
53
|
+ ```
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+* Sample Output
|
|
58
|
+
|
|
59
|
+ ```
|
|
60
|
+ 1 | 2 | 3 | 4 |
|
|
61
|
+ 2 | 4 | 6 | 8 |
|
|
62
|
+ 3 | 6 | 9 | 12 |
|
|
63
|
+ 4 | 8 | 12 | 16 |
|
|
64
|
+ ```
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+## `String getLargeMultiplicationTable()`
|
|
107
|
+* **Description**
|
|
108
|
+ * Given one integer, `width`, generate a `String` representation of a multiplication table whose dimensions are `width` by `width`
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+### Example
|
|
112
|
+* Sample Script
|
|
113
|
+
|
|
114
|
+ ```
|
|
115
|
+ // : Given
|
|
116
|
+ int n = 3;
|
|
117
|
+
|
|
118
|
+ // : When
|
|
119
|
+ String outcome = Tables.getLargeMultiplicationTable();
|
|
120
|
+
|
|
121
|
+ // : Then
|
|
122
|
+ System.out.println(outcome);
|
|
123
|
+ ```
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+* Sample Output
|
|
128
|
+
|
|
129
|
+ ```
|
|
130
|
+ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|
|
131
|
+ 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 |
|
|
132
|
+ 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 27 | 30 |
|
|
133
|
+ 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 |
|
|
134
|
+ 5 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 |
|
|
135
|
+ 6 | 12 | 18 | 24 | 30 | 36 | 42 | 48 | 54 | 60 |
|
|
136
|
+ 7 | 14 | 21 | 28 | 35 | 42 | 49 | 56 | 63 | 70 |
|
|
137
|
+ 8 | 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 |
|
|
138
|
+ 9 | 18 | 27 | 36 | 45 | 54 | 63 | 72 | 81 | 90 |
|
|
139
|
+ 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 |100 |
|
|
140
|
+
|
|
141
|
+ ```
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+## `String getMultiplicationTable(int width)`
|
4
|
179
|
* **Description**
|
5
|
|
- * Given one integer, `n`, generate a `String` representation of a multiplication table whose dimensions are `n` by `n`
|
|
180
|
+ * Given one integer, `width`, generate a `String` representation of a multiplication table whose dimensions are `width` by `width`
|
6
|
181
|
|
7
|
182
|
|
8
|
183
|
### Example 1
|
|
@@ -10,7 +185,7 @@
|
10
|
185
|
|
11
|
186
|
```
|
12
|
187
|
// : Given
|
13
|
|
- int n = 4;
|
|
188
|
+ int n = 3;
|
14
|
189
|
|
15
|
190
|
// : When
|
16
|
191
|
String outcome = Tables.getMultiplicationTable(n);
|
|
@@ -24,10 +199,9 @@
|
24
|
199
|
* Sample Output
|
25
|
200
|
|
26
|
201
|
```
|
27
|
|
- | 1 | 2 | 3 | 4 |
|
28
|
|
- | 2 | 4 | 6 | 8 |
|
29
|
|
- | 3 | 6 | 9 | 12 |
|
30
|
|
- | 4 | 8 | 12 | 16 |
|
|
202
|
+ 1 | 2 | 3 |
|
|
203
|
+ 2 | 4 | 6 |
|
|
204
|
+ 3 | 6 | 9 |
|
31
|
205
|
```
|
32
|
206
|
|
33
|
207
|
|
|
@@ -51,10 +225,10 @@
|
51
|
225
|
* Sample Output
|
52
|
226
|
|
53
|
227
|
```
|
54
|
|
- | 1 | 2 | 3 | 4 | 5 | 6 |
|
55
|
|
- | 2 | 4 | 6 | 8 | 10 | 12 |
|
56
|
|
- | 3 | 6 | 9 | 12 | 15 | 18 |
|
57
|
|
- | 4 | 8 | 12 | 16 | 20 | 24 |
|
58
|
|
- | 5 | 10 | 15 | 20 | 25 | 30 |
|
59
|
|
- | 6 | 12 | 18 | 24 | 30 | 36 |
|
|
228
|
+ 1 | 2 | 3 | 4 | 5 | 6 |
|
|
229
|
+ 2 | 4 | 6 | 8 | 10 | 12 |
|
|
230
|
+ 3 | 6 | 9 | 12 | 15 | 18 |
|
|
231
|
+ 4 | 8 | 12 | 16 | 20 | 24 |
|
|
232
|
+ 5 | 10 | 15 | 20 | 25 | 30 |
|
|
233
|
+ 6 | 12 | 18 | 24 | 30 | 36 |
|
60
|
234
|
```
|