|
@@ -1,4 +1,3 @@
|
1
|
|
-
|
2
|
1
|
|
3
|
2
|
/**
|
4
|
3
|
* Created by dan on 6/14/17.
|
|
@@ -11,7 +10,8 @@ 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
|
+ int finalVal= baseValue + difference;
|
|
14
|
+ return finalVal;
|
15
|
15
|
}
|
16
|
16
|
|
17
|
17
|
/**
|
|
@@ -20,7 +20,8 @@ public class MathUtilities {
|
20
|
20
|
* @return sum of `baseValue` and `difference`
|
21
|
21
|
*/
|
22
|
22
|
public Long add(long baseValue, long difference) {
|
23
|
|
- return null;
|
|
23
|
+ long addedVal = baseValue + difference;
|
|
24
|
+ return addedVal;
|
24
|
25
|
}
|
25
|
26
|
|
26
|
27
|
/**
|
|
@@ -29,8 +30,11 @@ 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
|
|
- }
|
|
33
|
+ int num1= baseValue;
|
|
34
|
+ int num2= difference;
|
|
35
|
+ int sum= (num1)+(num2);
|
|
36
|
+ return (short)sum;
|
|
37
|
+ }
|
34
|
38
|
|
35
|
39
|
/**
|
36
|
40
|
* @param baseValue starting value
|
|
@@ -38,7 +42,10 @@ public class MathUtilities {
|
38
|
42
|
* @return sum of `baseValue` and `difference`
|
39
|
43
|
*/
|
40
|
44
|
public Byte add(byte baseValue, byte difference) {
|
41
|
|
- return null;
|
|
45
|
+ int num1= baseValue;
|
|
46
|
+ int num2= difference;
|
|
47
|
+ int sum= (num1)+(num2);
|
|
48
|
+ return (byte)sum;
|
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 num1= baseValue + difference;
|
|
58
|
+ return num1;
|
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 num1=baseValue + difference;
|
|
68
|
+ return num1;
|
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 sub1=baseValue-difference;
|
|
78
|
+ return sub1;
|
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 sub2=baseValue-difference;
|
|
88
|
+ return sub2;
|
78
|
89
|
}
|
79
|
90
|
|
80
|
91
|
/**
|
|
@@ -83,7 +94,10 @@ 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
|
+ int num1=baseValue;
|
|
98
|
+ int num2=difference;
|
|
99
|
+ int sub3=(num1)-(num2);
|
|
100
|
+ return (short)sub3;
|
87
|
101
|
}
|
88
|
102
|
|
89
|
103
|
/**
|
|
@@ -92,7 +106,10 @@ public class MathUtilities {
|
92
|
106
|
* @return difference between `baseValue` and `difference`
|
93
|
107
|
*/
|
94
|
108
|
public Byte subtract(byte baseValue, byte difference) {
|
95
|
|
- return null;
|
|
109
|
+ int num1=baseValue;
|
|
110
|
+ int num2=difference;
|
|
111
|
+ int sub3=(num1)-(num2);
|
|
112
|
+ return (byte)sub3;
|
96
|
113
|
}
|
97
|
114
|
|
98
|
115
|
/**
|
|
@@ -101,7 +118,8 @@ public class MathUtilities {
|
101
|
118
|
* @return difference between `baseValue` and `difference`
|
102
|
119
|
*/
|
103
|
120
|
public Float subtract(float baseValue, float difference) {
|
104
|
|
- return null;
|
|
121
|
+ float sub4=baseValue-difference;
|
|
122
|
+ return sub4;
|
105
|
123
|
}
|
106
|
124
|
|
107
|
125
|
/**
|
|
@@ -110,17 +128,18 @@ public class MathUtilities {
|
110
|
128
|
* @return difference between `baseValue` and `difference`
|
111
|
129
|
*/
|
112
|
130
|
public Double subtract(double baseValue, double difference) {
|
113
|
|
- return null;
|
|
131
|
+ double sub5=baseValue-difference;
|
|
132
|
+ return sub5;
|
114
|
133
|
}
|
115
|
134
|
|
116
|
|
-
|
117
|
135
|
/**
|
118
|
136
|
* @param dividend value to be divided
|
119
|
137
|
* @param divisor value to divide by
|
120
|
138
|
* @return division of `dividend` by `divisor
|
121
|
139
|
*/
|
122
|
140
|
public Integer divide(int dividend, int divisor) {
|
123
|
|
- return null;
|
|
141
|
+ int div1= dividend/divisor;
|
|
142
|
+ return div1;
|
124
|
143
|
}
|
125
|
144
|
|
126
|
145
|
/**
|
|
@@ -129,7 +148,8 @@ public class MathUtilities {
|
129
|
148
|
* @return division of `dividend` by `divisor
|
130
|
149
|
*/
|
131
|
150
|
public Long divide(long dividend, long divisor) {
|
132
|
|
- return null;
|
|
151
|
+ long div2= dividend/divisor;
|
|
152
|
+ return div2;
|
133
|
153
|
}
|
134
|
154
|
|
135
|
155
|
/**
|
|
@@ -138,7 +158,10 @@ public class MathUtilities {
|
138
|
158
|
* @return division of `dividend` by `divisor
|
139
|
159
|
*/
|
140
|
160
|
public Short divide(short dividend, short divisor) {
|
141
|
|
- return null;
|
|
161
|
+ int num1=dividend;
|
|
162
|
+ int num2=divisor;
|
|
163
|
+ int div3=((num1)/(num2));
|
|
164
|
+ return(short)div3;
|
142
|
165
|
}
|
143
|
166
|
|
144
|
167
|
/**
|
|
@@ -147,7 +170,10 @@ public class MathUtilities {
|
147
|
170
|
* @return division of `dividend` by `divisor
|
148
|
171
|
*/
|
149
|
172
|
public Byte divide(byte dividend, byte divisor) {
|
150
|
|
- return null;
|
|
173
|
+ int num1=dividend;
|
|
174
|
+ int num2=divisor;
|
|
175
|
+ int div3=((num1)/(num2));
|
|
176
|
+ return(byte)div3;
|
151
|
177
|
}
|
152
|
178
|
|
153
|
179
|
/**
|
|
@@ -156,7 +182,8 @@ public class MathUtilities {
|
156
|
182
|
* @return division of `dividend` by `divisor
|
157
|
183
|
*/
|
158
|
184
|
public Float divide(float dividend, float divisor) {
|
159
|
|
- return null;
|
|
185
|
+ float div4= dividend/divisor;
|
|
186
|
+ return div4;
|
160
|
187
|
}
|
161
|
188
|
|
162
|
189
|
/**
|
|
@@ -165,17 +192,18 @@ public class MathUtilities {
|
165
|
192
|
* @return division of `dividend` by `divisor
|
166
|
193
|
*/
|
167
|
194
|
public Double divide(double dividend, double divisor) {
|
168
|
|
- return null;
|
|
195
|
+ double div5= dividend/divisor;
|
|
196
|
+ return div5;
|
169
|
197
|
}
|
170
|
198
|
|
171
|
|
-
|
172
|
199
|
/**
|
173
|
200
|
* @param multiplicand value to be multiplied
|
174
|
201
|
* @param multiplier value to multiply by
|
175
|
202
|
* @return product of `multiplicand` by `multiplier`
|
176
|
203
|
*/
|
177
|
204
|
public Integer multiply(int multiplicand, int multiplier) {
|
178
|
|
- return null;
|
|
205
|
+ int multi1= multiplicand* multiplier;
|
|
206
|
+ return multi1;
|
179
|
207
|
}
|
180
|
208
|
|
181
|
209
|
/**
|
|
@@ -184,7 +212,8 @@ public class MathUtilities {
|
184
|
212
|
* @return product of `multiplicand` by `multiplier`
|
185
|
213
|
*/
|
186
|
214
|
public Long multiply(long multiplicand, long multiplier) {
|
187
|
|
- return null;
|
|
215
|
+ long multi2= multiplicand* multiplier;
|
|
216
|
+ return multi2;
|
188
|
217
|
}
|
189
|
218
|
|
190
|
219
|
/**
|
|
@@ -193,15 +222,22 @@ public class MathUtilities {
|
193
|
222
|
* @return product of `multiplicand` by `multiplier`
|
194
|
223
|
*/
|
195
|
224
|
public Short multiply(short multiplicand, short multiplier) {
|
196
|
|
- return null;
|
|
225
|
+ int num1=multiplicand;
|
|
226
|
+ int num2=multiplier;
|
|
227
|
+ int multi3=((num1)*(num2));
|
|
228
|
+ return(short)multi3;
|
197
|
229
|
}
|
|
230
|
+
|
198
|
231
|
/**
|
199
|
232
|
* @param multiplicand value to be multiplied
|
200
|
233
|
* @param multiplier value to multiply by
|
201
|
234
|
* @return product of `multiplicand` by `multiplier`
|
202
|
235
|
*/
|
203
|
236
|
public Byte multiply(byte multiplicand, byte multiplier) {
|
204
|
|
- return null;
|
|
237
|
+ int num1=multiplicand;
|
|
238
|
+ int num2=multiplier;
|
|
239
|
+ int multi4=((num1)*(num2));
|
|
240
|
+ return(byte)multi4;
|
205
|
241
|
}
|
206
|
242
|
|
207
|
243
|
/**
|
|
@@ -210,7 +246,8 @@ public class MathUtilities {
|
210
|
246
|
* @return product of `multiplicand` by `multiplier`
|
211
|
247
|
*/
|
212
|
248
|
public Float multiply(float multiplicand, float multiplier) {
|
213
|
|
- return null;
|
|
249
|
+ float multi5=multiplicand*multiplier;
|
|
250
|
+ return multi5;
|
214
|
251
|
}
|
215
|
252
|
|
216
|
253
|
/**
|
|
@@ -219,22 +256,22 @@ public class MathUtilities {
|
219
|
256
|
* @return product of `multiplicand` by `multiplier`
|
220
|
257
|
*/
|
221
|
258
|
public Double multiply(double multiplicand, double multiplier) {
|
222
|
|
- return null;
|
|
259
|
+ double multi6=multiplicand*multiplier;
|
|
260
|
+ return multi6;
|
223
|
261
|
}
|
224
|
262
|
|
225
|
|
-
|
226
|
263
|
/**
|
227
|
|
- * @return true
|
|
264
|
+ * @return true
|
228
|
265
|
*/
|
229
|
266
|
public Boolean returnTrue() {
|
230
|
|
- return null;
|
|
267
|
+ return true;
|
231
|
268
|
}
|
232
|
269
|
|
233
|
270
|
/**
|
234
|
271
|
* @return false
|
235
|
272
|
*/
|
236
|
273
|
public Boolean returnFalse() {
|
237
|
|
- return null;
|
|
274
|
+ return false;
|
238
|
275
|
}
|
239
|
276
|
|
240
|
277
|
}
|