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