|
@@ -1,4 +1,3 @@
|
1
|
|
-
|
2
|
1
|
|
3
|
2
|
/**
|
4
|
3
|
* Created by dan on 6/14/17.
|
|
@@ -29,7 +28,8 @@ public class MathUtilities {
|
29
|
28
|
* @return sum of `baseValue` and `difference`
|
30
|
29
|
*/
|
31
|
30
|
public Short add(short baseValue, short difference) {
|
32
|
|
- return null;
|
|
31
|
+ int x = baseValue+ difference;
|
|
32
|
+ return (short)x;
|
33
|
33
|
}
|
34
|
34
|
|
35
|
35
|
/**
|
|
@@ -38,8 +38,8 @@ public class MathUtilities {
|
38
|
38
|
* @return sum of `baseValue` and `difference`
|
39
|
39
|
*/
|
40
|
40
|
public Byte add(byte baseValue, byte difference) {
|
41
|
|
-
|
42
|
|
- return null;
|
|
41
|
+ int x = baseValue +difference;
|
|
42
|
+ return (byte) x;
|
43
|
43
|
}
|
44
|
44
|
|
45
|
45
|
/**
|
|
@@ -48,7 +48,8 @@ public class MathUtilities {
|
48
|
48
|
* @return sum of `baseValue` and `difference`
|
49
|
49
|
*/
|
50
|
50
|
public Float add(float baseValue, float difference) {
|
51
|
|
- return null;
|
|
51
|
+
|
|
52
|
+ return baseValue + difference;
|
52
|
53
|
}
|
53
|
54
|
|
54
|
55
|
/**
|
|
@@ -75,7 +76,9 @@ public class MathUtilities {
|
75
|
76
|
* @return difference between `baseValue` and `difference`
|
76
|
77
|
*/
|
77
|
78
|
public Long subtract(long baseValue, long difference) {
|
78
|
|
- return null;
|
|
79
|
+ double x = baseValue - difference;
|
|
80
|
+ return (long) x;
|
|
81
|
+
|
79
|
82
|
}
|
80
|
83
|
|
81
|
84
|
/**
|
|
@@ -84,7 +87,9 @@ public class MathUtilities {
|
84
|
87
|
* @return difference between `baseValue` and `difference`
|
85
|
88
|
*/
|
86
|
89
|
public Short subtract(short baseValue, short difference) {
|
87
|
|
- return null;
|
|
90
|
+ int x = baseValue -difference;
|
|
91
|
+ return (short) x;
|
|
92
|
+
|
88
|
93
|
}
|
89
|
94
|
|
90
|
95
|
/**
|
|
@@ -93,7 +98,8 @@ public class MathUtilities {
|
93
|
98
|
* @return difference between `baseValue` and `difference`
|
94
|
99
|
*/
|
95
|
100
|
public Byte subtract(byte baseValue, byte difference) {
|
96
|
|
- return null;
|
|
101
|
+ int x = baseValue -difference;
|
|
102
|
+ return (byte) x;
|
97
|
103
|
}
|
98
|
104
|
|
99
|
105
|
/**
|
|
@@ -102,7 +108,7 @@ public class MathUtilities {
|
102
|
108
|
* @return difference between `baseValue` and `difference`
|
103
|
109
|
*/
|
104
|
110
|
public Float subtract(float baseValue, float difference) {
|
105
|
|
- return null;
|
|
111
|
+ return baseValue- difference;
|
106
|
112
|
}
|
107
|
113
|
|
108
|
114
|
/**
|
|
@@ -114,7 +120,6 @@ public class MathUtilities {
|
114
|
120
|
return baseValue - difference;
|
115
|
121
|
}
|
116
|
122
|
|
117
|
|
-
|
118
|
123
|
/**
|
119
|
124
|
* @param dividend value to be divided
|
120
|
125
|
* @param divisor value to divide by
|
|
@@ -139,7 +144,8 @@ public class MathUtilities {
|
139
|
144
|
* @return division of `dividend` by `divisor
|
140
|
145
|
*/
|
141
|
146
|
public Short divide(short dividend, short divisor) {
|
142
|
|
- return null;
|
|
147
|
+ int x =dividend /divisor;
|
|
148
|
+ return (short) x;
|
143
|
149
|
}
|
144
|
150
|
|
145
|
151
|
/**
|
|
@@ -148,7 +154,8 @@ public class MathUtilities {
|
148
|
154
|
* @return division of `dividend` by `divisor
|
149
|
155
|
*/
|
150
|
156
|
public Byte divide(byte dividend, byte divisor) {
|
151
|
|
- return null;
|
|
157
|
+ int x =dividend /divisor;
|
|
158
|
+ return (byte) x;
|
152
|
159
|
}
|
153
|
160
|
|
154
|
161
|
/**
|
|
@@ -169,7 +176,6 @@ public class MathUtilities {
|
169
|
176
|
return dividend/divisor;
|
170
|
177
|
}
|
171
|
178
|
|
172
|
|
-
|
173
|
179
|
/**
|
174
|
180
|
* @param multiplicand value to be multiplied
|
175
|
181
|
* @param multiplier value to multiply by
|
|
@@ -185,7 +191,8 @@ public class MathUtilities {
|
185
|
191
|
* @return product of `multiplicand` by `multiplier`
|
186
|
192
|
*/
|
187
|
193
|
public Long multiply(long multiplicand, long multiplier) {
|
188
|
|
- return null;
|
|
194
|
+ double x =multiplicand * multiplier;
|
|
195
|
+ return (long) x;
|
189
|
196
|
}
|
190
|
197
|
|
191
|
198
|
/**
|
|
@@ -194,15 +201,20 @@ public class MathUtilities {
|
194
|
201
|
* @return product of `multiplicand` by `multiplier`
|
195
|
202
|
*/
|
196
|
203
|
public Short multiply(short multiplicand, short multiplier) {
|
197
|
|
- return null;
|
|
204
|
+ int x =multiplicand * multiplier;
|
|
205
|
+ return (short) x;
|
|
206
|
+
|
198
|
207
|
}
|
|
208
|
+
|
199
|
209
|
/**
|
200
|
210
|
* @param multiplicand value to be multiplied
|
201
|
211
|
* @param multiplier value to multiply by
|
202
|
212
|
* @return product of `multiplicand` by `multiplier`
|
203
|
213
|
*/
|
204
|
214
|
public Byte multiply(byte multiplicand, byte multiplier) {
|
205
|
|
- return null;
|
|
215
|
+ int x =multiplicand * multiplier;
|
|
216
|
+ return (byte) x;
|
|
217
|
+
|
206
|
218
|
}
|
207
|
219
|
|
208
|
220
|
/**
|
|
@@ -211,7 +223,7 @@ public class MathUtilities {
|
211
|
223
|
* @return product of `multiplicand` by `multiplier`
|
212
|
224
|
*/
|
213
|
225
|
public Float multiply(float multiplicand, float multiplier) {
|
214
|
|
- return null;
|
|
226
|
+ return multiplicand*multiplier;
|
215
|
227
|
}
|
216
|
228
|
|
217
|
229
|
/**
|
|
@@ -223,9 +235,8 @@ public class MathUtilities {
|
223
|
235
|
return multiplicand * multiplier ;
|
224
|
236
|
}
|
225
|
237
|
|
226
|
|
-
|
227
|
238
|
/**
|
228
|
|
- * @return true
|
|
239
|
+ * @return true
|
229
|
240
|
*/
|
230
|
241
|
public Boolean returnTrue() {
|
231
|
242
|
return true;
|