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