|
@@ -1,10 +1,10 @@
|
1
|
1
|
# ZCW-MicroLabs-Loops
|
2
|
2
|
|
3
|
|
-## 1) 1 to 10
|
4
|
|
-In the class **Numbers**, complete the method called **oneToTen()** so that it returns a string of the numbers 1 to 10. The Unit Test is provided for you.
|
|
3
|
+ ## 1) 0 to 9
|
|
4
|
+ In the class **Numbers**, complete the method called **oneToNine()** so that it returns a string of the numbers 0 to 9. The Unit Test is provided for you.
|
5
|
5
|
|
6
|
|
-### Example<br>
|
7
|
|
-1: oneToTen()<br>
|
|
6
|
+ ### Example<br>
|
|
7
|
+1: oneToNine()<br>
|
8
|
8
|
2: *** Output ***<br>
|
9
|
9
|
3: 1<br>
|
10
|
10
|
4: 2<br>
|
|
@@ -18,9 +18,9 @@ In the class **Numbers**, complete the method called **oneToTen()** so that it r
|
18
|
18
|
12: 10<br>
|
19
|
19
|
|
20
|
20
|
## 2) Odd Numbers
|
21
|
|
-In the class **Numbers**, complete the method called **oddNumbers()** so that it returns a string of the positive odd numbers less than 20. The Unit Test is not provided for you, you must complete it.
|
|
21
|
+ In the class **Numbers**, complete the method called **oddNumbers()** so that it returns a string of the positive odd numbers less than 20. The Unit Test is not provided for you, you must complete it.
|
22
|
22
|
|
23
|
|
-### Example<br>
|
|
23
|
+ ### Example<br>
|
24
|
24
|
1: oddNumbers()<br>
|
25
|
25
|
2: *** Output *** <br>
|
26
|
26
|
3: 1<br>
|
|
@@ -35,9 +35,9 @@ In the class **Numbers**, complete the method called **oddNumbers()** so that it
|
35
|
35
|
12: 19<br>
|
36
|
36
|
|
37
|
37
|
## 3) Square Numbers
|
38
|
|
-In the class **Numbers**, complete the method called **squares()** so that it returns a string of the square numbers up to 100. The Unit Test is not provided for you, you must complete it.
|
|
38
|
+ In the class **Numbers**, complete the method called **squares()** so that it returns a string of the square numbers up to 100. The Unit Test is not provided for you, you must complete it.
|
39
|
39
|
|
40
|
|
-### Example<br>
|
|
40
|
+ ### Example<br>
|
41
|
41
|
1: squares()<br>
|
42
|
42
|
2: *** Output *** <br>
|
43
|
43
|
3: 1<br>
|
|
@@ -52,9 +52,9 @@ In the class **Numbers**, complete the method called **squares()** so that it re
|
52
|
52
|
12: 100<br>
|
53
|
53
|
|
54
|
54
|
## 4) Random Numbers
|
55
|
|
-In the class **Numbers**, complete the method called **random4()** so that it returns a string of out four random integers between 1 and 10. The Unit Test is not provided for you, you must complete it.
|
|
55
|
+ In the class **Numbers**, complete the method called **random4()** so that it returns a string of out four random integers between 1 and 10. The Unit Test is not provided for you, you must complete it.
|
56
|
56
|
|
57
|
|
-### Example<br>
|
|
57
|
+ ### Example<br>
|
58
|
58
|
1: random4()<br>
|
59
|
59
|
2: *** Output *** <br>
|
60
|
60
|
3: 3<br>
|
|
@@ -66,7 +66,7 @@ In the class **Numbers**, complete the method called **random4()** so that it re
|
66
|
66
|
|
67
|
67
|
In the class **Numbers**, complete the method called **even()** so that it returns a string of the positive even numbers less than n. The Unit Test is not provided for you, you must complete it.
|
68
|
68
|
|
69
|
|
-### Example<br>
|
|
69
|
+ ### Example<br>
|
70
|
70
|
1: even(20)<br>
|
71
|
71
|
2: *** Output *** <br>
|
72
|
72
|
3: 2<br>
|
|
@@ -81,9 +81,9 @@ In the class **Numbers**, complete the method called **even()** so that it retur
|
81
|
81
|
|
82
|
82
|
## 6) Powers of 2
|
83
|
83
|
|
84
|
|
-In the class **Numbers**, complete the method called **powers()** so that it returns a string of out the powers of 2 from 2^1 up to to 2^n. The Unit Test is not provided for you, you must complete it.
|
|
84
|
+ In the class **Numbers**, complete the method called **powers()** so that it returns a string of out the powers of 2 from 2^1 up to to 2^n. The Unit Test is not provided for you, you must complete it.
|
85
|
85
|
|
86
|
|
-### Example<br>
|
|
86
|
+ ### Example<br>
|
87
|
87
|
1: powers(8)<br>
|
88
|
88
|
2: *** Output *** <br>
|
89
|
89
|
3: 2<br>
|
|
@@ -97,9 +97,9 @@ In the class **Numbers**, complete the method called **powers()** so that it ret
|
97
|
97
|
|
98
|
98
|
## 7) Are we there yet?
|
99
|
99
|
|
100
|
|
-In the class **CarRide**, complete the class so that it returns that outputs "Are we there yet?" and then waits for input. If the input is "Yes" the program ouputs "Good!" and exits, otherwite the program loops. The Unit Tests is not provided for you, you must complete it.
|
|
100
|
+ In the class **CarRide**, complete the class so that it returns that outputs "Are we there yet?" and then waits for input. If the input is "Yes" the program ouputs "Good!" and exits, otherwite the program loops. The Unit Tests is not provided for you, you must complete it.
|
101
|
101
|
|
102
|
|
-### Example<br>
|
|
102
|
+ ### Example<br>
|
103
|
103
|
1: "Are we there yet?"<br>
|
104
|
104
|
2: No<br>
|
105
|
105
|
3: "Are we there yet?"<br>
|
|
@@ -110,9 +110,9 @@ In the class **CarRide**, complete the class so that it returns that outputs "Ar
|
110
|
110
|
|
111
|
111
|
## 8) Triangle
|
112
|
112
|
|
113
|
|
-In the class **Shapes**, complete the method called **triangle()** so that it uses nested loops to produce the following pattern . The Unit Test is not provided for you, you must complete it.
|
|
113
|
+ In the class **Shapes**, complete the method called **triangle()** so that it uses nested loops to produce the following pattern . The Unit Test is not provided for you, you must complete it.
|
114
|
114
|
|
115
|
|
-### Example<br>
|
|
115
|
+ ### Example<br>
|
116
|
116
|
1: triangle()<br>
|
117
|
117
|
2: *** Output *** <br>
|
118
|
118
|
3: * <br>
|
|
@@ -123,36 +123,36 @@ In the class **Shapes**, complete the method called **triangle()** so that it us
|
123
|
123
|
|
124
|
124
|
## 9) Table Square
|
125
|
125
|
|
126
|
|
-In the class **Shapes**, complete the method called **tableSquare()** so that it uses nested loops to produce a 4x4 table square. The Unit Test is not provided for you, you must complete it.
|
|
126
|
+ In the class **Shapes**, complete the method called **tableSquare()** so that it uses nested loops to produce a 4x4 table square. The Unit Test is not provided for you, you must complete it.
|
127
|
127
|
|
128
|
|
-### Example<br>
|
|
128
|
+ ### Example<br>
|
129
|
129
|
tableSquare()<br>
|
130
|
130
|
*** Output *** <br>
|
131
|
131
|
A 4 x 4 table square<br>
|
132
|
132
|
|
133
|
133
|
```
|
134
|
|
- | 1 | 2 | 3 | 4 |
|
135
|
|
- | 2 | 4 | 6 | 8 |
|
136
|
|
- | 3 | 6 | 9 | 12 |
|
137
|
|
- | 4 | 8 | 12 | 16 |
|
138
|
|
-
|
139
|
|
- ```
|
|
134
|
+ | 1 | 2 | 3 | 4 |
|
|
135
|
+ | 2 | 4 | 6 | 8 |
|
|
136
|
+ | 3 | 6 | 9 | 12 |
|
|
137
|
+ | 4 | 8 | 12 | 16 |
|
140
|
138
|
|
141
|
|
-## 10) Table Squares
|
|
139
|
+ ```
|
142
|
140
|
|
143
|
|
-In the class **Shapes**, extend your answer to the last question produce a method that will return string of characters out og ***n x n*** table square. The Unit Test is not provided for you, you must complete it.
|
|
141
|
+ ## 10) Table Squares
|
144
|
142
|
|
145
|
|
-### Example<br>
|
|
143
|
+ In the class **Shapes**, extend your answer to the last question produce a method that will return string of characters out og ***n x n*** table square. The Unit Test is not provided for you, you must complete it.
|
|
144
|
+
|
|
145
|
+ ### Example<br>
|
146
|
146
|
tableSquares(6)<br>
|
147
|
147
|
*** Output *** <br>
|
148
|
148
|
A 6 x 6 table square<br>
|
149
|
149
|
|
150
|
150
|
```
|
151
|
|
- | 1 | 2 | 3 | 4 | 5 | 6 |
|
152
|
|
- | 2 | 4 | 6 | 8 | 10 | 12 |
|
153
|
|
- | 3 | 6 | 9 | 12 | 15 | 18 |
|
154
|
|
- | 4 | 8 | 12 | 16 | 20 | 24 |
|
155
|
|
- | 5 | 10 | 15 | 20 | 25 | 30 |
|
156
|
|
- | 6 | 12 | 18 | 24 | 30 | 36 |
|
157
|
|
- ```
|
|
151
|
+ | 1 | 2 | 3 | 4 | 5 | 6 |
|
|
152
|
+ | 2 | 4 | 6 | 8 | 10 | 12 |
|
|
153
|
+ | 3 | 6 | 9 | 12 | 15 | 18 |
|
|
154
|
+ | 4 | 8 | 12 | 16 | 20 | 24 |
|
|
155
|
+ | 5 | 10 | 15 | 20 | 25 | 30 |
|
|
156
|
+ | 6 | 12 | 18 | 24 | 30 | 36 |
|
|
157
|
+ ```
|
158
|
158
|
|