|
|
|
|
35
|
12: 19<br>
|
35
|
12: 19<br>
|
36
|
|
36
|
|
37
|
## 3) Square Numbers
|
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
|
1: squares()<br>
|
41
|
1: squares()<br>
|
|
|
|
|
67
|
|
67
|
|
68
|
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
|
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.
|
69
|
|
69
|
|
70
|
- ### Example<br>
|
|
|
|
|
70
|
+### Example<br>
|
71
|
1: even(20)<br>
|
71
|
1: even(20)<br>
|
72
|
2: *** Output *** <br>
|
72
|
2: *** Output *** <br>
|
73
|
3: 2<br>
|
73
|
3: 2<br>
|
|
|
|
|
82
|
|
82
|
|
83
|
## 6) Powers of 2
|
83
|
## 6) Powers of 2
|
84
|
|
84
|
|
85
|
- 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
|
+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.
|
86
|
|
86
|
|
87
|
- ### Example<br>
|
|
|
|
|
87
|
+### Example<br>
|
88
|
1: powers(8)<br>
|
88
|
1: powers(8)<br>
|
89
|
2: *** Output *** <br>
|
89
|
2: *** Output *** <br>
|
90
|
3: 2<br>
|
90
|
3: 2<br>
|
|
|
|
|
98
|
|
98
|
|
99
|
## 7) Are we there yet?
|
99
|
## 7) Are we there yet?
|
100
|
|
100
|
|
101
|
- 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
|
+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.
|
102
|
|
102
|
|
103
|
- ### Example<br>
|
|
|
|
|
103
|
+### Example<br>
|
104
|
1: "Are we there yet?"<br>
|
104
|
1: "Are we there yet?"<br>
|
105
|
2: No<br>
|
105
|
2: No<br>
|
106
|
3: "Are we there yet?"<br>
|
106
|
3: "Are we there yet?"<br>
|
|
|
|
|
111
|
|
111
|
|
112
|
## 8) Triangle
|
112
|
## 8) Triangle
|
113
|
|
113
|
|
114
|
- 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
|
+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.
|
115
|
|
115
|
|
116
|
- ### Example<br>
|
|
|
|
|
116
|
+### Example<br>
|
117
|
1: triangle()<br>
|
117
|
1: triangle()<br>
|
118
|
2: *** Output *** <br>
|
118
|
2: *** Output *** <br>
|
119
|
3: * <br>
|
119
|
3: * <br>
|
|
|
|
|
124
|
|
124
|
|
125
|
## 9) Table Square
|
125
|
## 9) Table Square
|
126
|
|
126
|
|
127
|
- 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
|
+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.
|
128
|
|
128
|
|
129
|
- ### Example<br>
|
|
|
|
|
129
|
+### Example<br>
|
130
|
tableSquare()<br>
|
130
|
tableSquare()<br>
|
131
|
*** Output *** <br>
|
131
|
*** Output *** <br>
|
132
|
A 4 x 4 table square<br>
|
132
|
A 4 x 4 table square<br>
|
|
|
|
|
139
|
|
139
|
|
140
|
```
|
140
|
```
|
141
|
|
141
|
|
142
|
- ## 10) Table Squares
|
|
|
|
|
142
|
+ ## 10) Table Squares
|
143
|
|
143
|
|
144
|
- 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
|
+ 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.
|
145
|
|
145
|
|
146
|
- ### Example<br>
|
|
|
|
|
146
|
+### Example<br>
|
147
|
tableSquares(6)<br>
|
147
|
tableSquares(6)<br>
|
148
|
*** Output *** <br>
|
148
|
*** Output *** <br>
|
149
|
A 6 x 6 table square<br>
|
149
|
A 6 x 6 table square<br>
|