|
@@ -11,7 +11,9 @@ public class MathUtilities {
|
11
|
11
|
* @return sum of `baseValue` and `difference`
|
12
|
12
|
*/
|
13
|
13
|
public Integer add(int baseValue, int difference) {
|
14
|
|
- return null;
|
|
14
|
+ int sum = baseValue + difference;
|
|
15
|
+
|
|
16
|
+ return sum;
|
15
|
17
|
}
|
16
|
18
|
|
17
|
19
|
/**
|
|
@@ -20,7 +22,9 @@ public class MathUtilities {
|
20
|
22
|
* @return sum of `baseValue` and `difference`
|
21
|
23
|
*/
|
22
|
24
|
public Long add(long baseValue, long difference) {
|
23
|
|
- return null;
|
|
25
|
+
|
|
26
|
+ long sum = baseValue + difference;
|
|
27
|
+ return sum;
|
24
|
28
|
}
|
25
|
29
|
|
26
|
30
|
/**
|
|
@@ -29,7 +33,9 @@ public class MathUtilities {
|
29
|
33
|
* @return sum of `baseValue` and `difference`
|
30
|
34
|
*/
|
31
|
35
|
public Short add(short baseValue, short difference) {
|
32
|
|
- return null;
|
|
36
|
+ int s = baseValue + difference;
|
|
37
|
+ short value = (short) s;
|
|
38
|
+ return value;
|
33
|
39
|
}
|
34
|
40
|
|
35
|
41
|
/**
|
|
@@ -38,7 +44,9 @@ public class MathUtilities {
|
38
|
44
|
* @return sum of `baseValue` and `difference`
|
39
|
45
|
*/
|
40
|
46
|
public Byte add(byte baseValue, byte difference) {
|
41
|
|
- return null;
|
|
47
|
+ int b = baseValue + difference;
|
|
48
|
+ byte by = (byte)b;
|
|
49
|
+ return by;
|
42
|
50
|
}
|
43
|
51
|
|
44
|
52
|
/**
|
|
@@ -47,7 +55,8 @@ public class MathUtilities {
|
47
|
55
|
* @return sum of `baseValue` and `difference`
|
48
|
56
|
*/
|
49
|
57
|
public Float add(float baseValue, float difference) {
|
50
|
|
- return null;
|
|
58
|
+ float f = baseValue + difference;
|
|
59
|
+ return f;
|
51
|
60
|
}
|
52
|
61
|
|
53
|
62
|
/**
|
|
@@ -56,7 +65,8 @@ public class MathUtilities {
|
56
|
65
|
* @return sum of `baseValue` and `difference`
|
57
|
66
|
*/
|
58
|
67
|
public Double add(double baseValue, double difference) {
|
59
|
|
- return null;
|
|
68
|
+ double d = baseValue + difference;
|
|
69
|
+ return d;
|
60
|
70
|
}
|
61
|
71
|
|
62
|
72
|
/**
|
|
@@ -65,7 +75,9 @@ public class MathUtilities {
|
65
|
75
|
* @return difference between `baseValue` and `difference`
|
66
|
76
|
*/
|
67
|
77
|
public Integer subtract(int baseValue, int difference) {
|
68
|
|
- return null;
|
|
78
|
+ int i = baseValue - difference;
|
|
79
|
+
|
|
80
|
+ return i;
|
69
|
81
|
}
|
70
|
82
|
|
71
|
83
|
/**
|
|
@@ -74,7 +86,9 @@ public class MathUtilities {
|
74
|
86
|
* @return difference between `baseValue` and `difference`
|
75
|
87
|
*/
|
76
|
88
|
public Long subtract(long baseValue, long difference) {
|
77
|
|
- return null;
|
|
89
|
+ long l = baseValue - difference;
|
|
90
|
+
|
|
91
|
+ return l;
|
78
|
92
|
}
|
79
|
93
|
|
80
|
94
|
/**
|
|
@@ -83,7 +97,9 @@ public class MathUtilities {
|
83
|
97
|
* @return difference between `baseValue` and `difference`
|
84
|
98
|
*/
|
85
|
99
|
public Short subtract(short baseValue, short difference) {
|
86
|
|
- return null;
|
|
100
|
+ int s = baseValue - difference;
|
|
101
|
+ short value = (short) s;
|
|
102
|
+ return value;
|
87
|
103
|
}
|
88
|
104
|
|
89
|
105
|
/**
|
|
@@ -92,7 +108,9 @@ public class MathUtilities {
|
92
|
108
|
* @return difference between `baseValue` and `difference`
|
93
|
109
|
*/
|
94
|
110
|
public Byte subtract(byte baseValue, byte difference) {
|
95
|
|
- return null;
|
|
111
|
+ int b = baseValue - difference;
|
|
112
|
+ byte by = (byte)b;
|
|
113
|
+ return by;
|
96
|
114
|
}
|
97
|
115
|
|
98
|
116
|
/**
|
|
@@ -101,7 +119,9 @@ public class MathUtilities {
|
101
|
119
|
* @return difference between `baseValue` and `difference`
|
102
|
120
|
*/
|
103
|
121
|
public Float subtract(float baseValue, float difference) {
|
104
|
|
- return null;
|
|
122
|
+ float f = baseValue - difference;
|
|
123
|
+
|
|
124
|
+ return f;
|
105
|
125
|
}
|
106
|
126
|
|
107
|
127
|
/**
|
|
@@ -110,7 +130,8 @@ public class MathUtilities {
|
110
|
130
|
* @return difference between `baseValue` and `difference`
|
111
|
131
|
*/
|
112
|
132
|
public Double subtract(double baseValue, double difference) {
|
113
|
|
- return null;
|
|
133
|
+ double d = baseValue - difference;
|
|
134
|
+ return d;
|
114
|
135
|
}
|
115
|
136
|
|
116
|
137
|
|
|
@@ -120,7 +141,9 @@ public class MathUtilities {
|
120
|
141
|
* @return division of `dividend` by `divisor
|
121
|
142
|
*/
|
122
|
143
|
public Integer divide(int dividend, int divisor) {
|
123
|
|
- return null;
|
|
144
|
+ int div = dividend / divisor;
|
|
145
|
+
|
|
146
|
+ return div;
|
124
|
147
|
}
|
125
|
148
|
|
126
|
149
|
/**
|
|
@@ -129,7 +152,9 @@ public class MathUtilities {
|
129
|
152
|
* @return division of `dividend` by `divisor
|
130
|
153
|
*/
|
131
|
154
|
public Long divide(long dividend, long divisor) {
|
132
|
|
- return null;
|
|
155
|
+ long div = dividend / divisor;
|
|
156
|
+
|
|
157
|
+ return div;
|
133
|
158
|
}
|
134
|
159
|
|
135
|
160
|
/**
|
|
@@ -138,7 +163,9 @@ public class MathUtilities {
|
138
|
163
|
* @return division of `dividend` by `divisor
|
139
|
164
|
*/
|
140
|
165
|
public Short divide(short dividend, short divisor) {
|
141
|
|
- return null;
|
|
166
|
+ int s = dividend / divisor;
|
|
167
|
+ short value = (short) s;
|
|
168
|
+ return value;
|
142
|
169
|
}
|
143
|
170
|
|
144
|
171
|
/**
|
|
@@ -147,7 +174,9 @@ public class MathUtilities {
|
147
|
174
|
* @return division of `dividend` by `divisor
|
148
|
175
|
*/
|
149
|
176
|
public Byte divide(byte dividend, byte divisor) {
|
150
|
|
- return null;
|
|
177
|
+ int b = dividend / divisor;
|
|
178
|
+ byte by = (byte)b;
|
|
179
|
+ return by;
|
151
|
180
|
}
|
152
|
181
|
|
153
|
182
|
/**
|
|
@@ -156,7 +185,9 @@ public class MathUtilities {
|
156
|
185
|
* @return division of `dividend` by `divisor
|
157
|
186
|
*/
|
158
|
187
|
public Float divide(float dividend, float divisor) {
|
159
|
|
- return null;
|
|
188
|
+ float f = dividend / divisor;
|
|
189
|
+
|
|
190
|
+ return f;
|
160
|
191
|
}
|
161
|
192
|
|
162
|
193
|
/**
|
|
@@ -165,7 +196,8 @@ public class MathUtilities {
|
165
|
196
|
* @return division of `dividend` by `divisor
|
166
|
197
|
*/
|
167
|
198
|
public Double divide(double dividend, double divisor) {
|
168
|
|
- return null;
|
|
199
|
+ double div = dividend / divisor;
|
|
200
|
+ return div;
|
169
|
201
|
}
|
170
|
202
|
|
171
|
203
|
|
|
@@ -175,7 +207,9 @@ public class MathUtilities {
|
175
|
207
|
* @return product of `multiplicand` by `multiplier`
|
176
|
208
|
*/
|
177
|
209
|
public Integer multiply(int multiplicand, int multiplier) {
|
178
|
|
- return null;
|
|
210
|
+ int mul = multiplicand * multiplier;
|
|
211
|
+
|
|
212
|
+ return mul;
|
179
|
213
|
}
|
180
|
214
|
|
181
|
215
|
/**
|
|
@@ -184,7 +218,9 @@ public class MathUtilities {
|
184
|
218
|
* @return product of `multiplicand` by `multiplier`
|
185
|
219
|
*/
|
186
|
220
|
public Long multiply(long multiplicand, long multiplier) {
|
187
|
|
- return null;
|
|
221
|
+ long mul = multiplicand * multiplier;
|
|
222
|
+
|
|
223
|
+ return mul;
|
188
|
224
|
}
|
189
|
225
|
|
190
|
226
|
/**
|
|
@@ -193,7 +229,9 @@ public class MathUtilities {
|
193
|
229
|
* @return product of `multiplicand` by `multiplier`
|
194
|
230
|
*/
|
195
|
231
|
public Short multiply(short multiplicand, short multiplier) {
|
196
|
|
- return null;
|
|
232
|
+ int s = multiplicand * multiplier;
|
|
233
|
+ short value = (short) s;
|
|
234
|
+ return value;
|
197
|
235
|
}
|
198
|
236
|
/**
|
199
|
237
|
* @param multiplicand value to be multiplied
|
|
@@ -201,7 +239,9 @@ public class MathUtilities {
|
201
|
239
|
* @return product of `multiplicand` by `multiplier`
|
202
|
240
|
*/
|
203
|
241
|
public Byte multiply(byte multiplicand, byte multiplier) {
|
204
|
|
- return null;
|
|
242
|
+ int b = multiplicand * multiplier;
|
|
243
|
+ byte by = (byte)b;
|
|
244
|
+ return by;
|
205
|
245
|
}
|
206
|
246
|
|
207
|
247
|
/**
|
|
@@ -210,7 +250,9 @@ public class MathUtilities {
|
210
|
250
|
* @return product of `multiplicand` by `multiplier`
|
211
|
251
|
*/
|
212
|
252
|
public Float multiply(float multiplicand, float multiplier) {
|
213
|
|
- return null;
|
|
253
|
+ float f = multiplicand * multiplier;
|
|
254
|
+
|
|
255
|
+ return f;
|
214
|
256
|
}
|
215
|
257
|
|
216
|
258
|
/**
|
|
@@ -219,7 +261,9 @@ public class MathUtilities {
|
219
|
261
|
* @return product of `multiplicand` by `multiplier`
|
220
|
262
|
*/
|
221
|
263
|
public Double multiply(double multiplicand, double multiplier) {
|
222
|
|
- return null;
|
|
264
|
+ double mul = multiplicand * multiplier;
|
|
265
|
+
|
|
266
|
+ return mul;
|
223
|
267
|
}
|
224
|
268
|
|
225
|
269
|
|
|
@@ -227,14 +271,14 @@ public class MathUtilities {
|
227
|
271
|
* @return true
|
228
|
272
|
*/
|
229
|
273
|
public Boolean returnTrue() {
|
230
|
|
- return null;
|
|
274
|
+ return true;
|
231
|
275
|
}
|
232
|
276
|
|
233
|
277
|
/**
|
234
|
278
|
* @return false
|
235
|
279
|
*/
|
236
|
280
|
public Boolean returnFalse() {
|
237
|
|
- return null;
|
|
281
|
+ return false;
|
238
|
282
|
}
|
239
|
283
|
|
240
|
284
|
}
|