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