瀏覽代碼

I am finished this lab

Jordan Elderidge 6 年之前
父節點
當前提交
53279f83f3

+ 34
- 26
src/main/java/com/zipcodewilmington/danny_do_better_exercises/MathUtilities.java 查看文件

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

+ 2
- 1
src/main/java/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.java 查看文件

85
      * @return an identical string with characters in reverse order.
85
      * @return an identical string with characters in reverse order.
86
      */
86
      */
87
     public static String reverseTheTwo(String stringToReverse){
87
     public static String reverseTheTwo(String stringToReverse){
88
-        return null;
88
+        String old = new StringBuilder(stringToReverse).reverse().toString();
89
+        return old;
89
     }
90
     }
90
 }
91
 }

二進制
target/classes/com/zipcodewilmington/danny_do_better_exercises/MathUtilities.class 查看文件


二進制
target/classes/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.class 查看文件