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