#32 finished

오픈
jbedolla40 jbedolla40/CR-MicroLabs-JavaFundamentals-DanDoBetterDrills:master 에서 master 로 3 commits 를 머지하려 합니다
7개의 변경된 파일135개의 추가작업 그리고 55개의 파일을 삭제
  1. BIN
      MathUtilities.class
  2. 70
    26
      MathUtilities.java
  3. BIN
      PredicateUtilities.class
  4. 20
    4
      PredicateUtilities.java
  5. BIN
      StringUtilities.class
  6. 29
    10
      StringUtilities.java
  7. 16
    15
      package.bluej

BIN
MathUtilities.class 파일 보기


+ 70
- 26
MathUtilities.java 파일 보기

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

BIN
PredicateUtilities.class 파일 보기


+ 20
- 4
PredicateUtilities.java 파일 보기

10
      * @return true if `x` is greater than `y`
10
      * @return true if `x` is greater than `y`
11
      */
11
      */
12
     public Boolean isGreaterThan(int x, int y) {
12
     public Boolean isGreaterThan(int x, int y) {
13
-        return null;
13
+        if(x>y)
14
+        {
15
+        return true;
16
+        }
17
+        return false;
14
     }
18
     }
15
 
19
 
16
     /**
20
     /**
19
      * @return true if `x` is less than `y`
23
      * @return true if `x` is less than `y`
20
      */
24
      */
21
     public Boolean isLessThan(int x, int y) {
25
     public Boolean isLessThan(int x, int y) {
22
-        return null;
26
+        if(x<y)
27
+        {
28
+        return true;
29
+        }
30
+        return false;
23
     }
31
     }
24
 
32
 
25
     /**
33
     /**
28
      * @return true if `x` is greater than or equal to `y`
36
      * @return true if `x` is greater than or equal to `y`
29
      */
37
      */
30
     public Boolean isGreaterThanOrEqualTo(int x, int y) {
38
     public Boolean isGreaterThanOrEqualTo(int x, int y) {
31
-        return null;
39
+        if(x >= y)
40
+        {
41
+            return true;
42
+        }
43
+        return false;
32
     }
44
     }
33
 
45
 
34
     /**
46
     /**
37
      * @return true if `x` is less than or equal to `y`
49
      * @return true if `x` is less than or equal to `y`
38
      */
50
      */
39
     public Boolean isLessThanOrEqualTo(int x, int y) {
51
     public Boolean isLessThanOrEqualTo(int x, int y) {
40
-        return null;
52
+        if(x <= y)
53
+        {
54
+            return true;
55
+        }
56
+        return false;
41
     }
57
     }
42
 }
58
 }

BIN
StringUtilities.class 파일 보기


+ 29
- 10
StringUtilities.java 파일 보기

8
      * @return `Hello World` as a string
8
      * @return `Hello World` as a string
9
      */
9
      */
10
     public static String getHelloWorld() {
10
     public static String getHelloWorld() {
11
-        return null;
11
+        return "Hello World";
12
     }
12
     }
13
 
13
 
14
     /**
14
     /**
17
      * @return the concatenation of two strings, `firstSegment`, and `secondSegment`
17
      * @return the concatenation of two strings, `firstSegment`, and `secondSegment`
18
      */
18
      */
19
     public static String concatenation(String firstSegment, String secondSegment){
19
     public static String concatenation(String firstSegment, String secondSegment){
20
-        return null;
20
+        String together = firstSegment + secondSegment;//String.format(firstSegment,secondSegment);
21
+        return together;
21
     }
22
     }
22
 
23
 
23
     /**
24
     /**
26
      * @return the concatenation of an integer, `firstSegment`, and a String, `secondSegment`
27
      * @return the concatenation of an integer, `firstSegment`, and a String, `secondSegment`
27
      */
28
      */
28
     public static String concatenation(int firstSegment, String secondSegment){
29
     public static String concatenation(int firstSegment, String secondSegment){
29
-        return null;
30
+        String together = firstSegment + secondSegment;
31
+        return together;
30
     }
32
     }
31
 
33
 
32
     /**
34
     /**
34
      * @return the first 3 characters of `input`
36
      * @return the first 3 characters of `input`
35
      */
37
      */
36
     public static String getPrefix(String input){
38
     public static String getPrefix(String input){
37
-        return null;
39
+       
40
+        return input.substring(0,3);
38
     }
41
     }
39
 
42
 
40
     /**
43
     /**
42
      * @return the last 3 characters of `input`
45
      * @return the last 3 characters of `input`
43
      */
46
      */
44
     public static String getSuffix(String input){
47
     public static String getSuffix(String input){
45
-        return null;
48
+        
49
+        int lenght = input.length();
50
+        String n = input.substring(input.length() -3);
51
+        return n;
46
     }
52
     }
47
 
53
 
48
     /**
54
     /**
51
      * @return the equivalence of two strings, `inputValue` and `comparableValue`
57
      * @return the equivalence of two strings, `inputValue` and `comparableValue`
52
      */
58
      */
53
     public static Boolean compareTwoStrings(String inputValue, String comparableValue){
59
     public static Boolean compareTwoStrings(String inputValue, String comparableValue){
54
-        return null;
60
+        if(inputValue == comparableValue)
61
+        {
62
+         return true;
63
+        }
64
+        return false;
55
     }
65
     }
56
 
66
 
57
     /**
67
     /**
59
      * @return the middle character of `inputValue`
69
      * @return the middle character of `inputValue`
60
      */
70
      */
61
     public static Character getMiddleCharacter(String inputValue){
71
     public static Character getMiddleCharacter(String inputValue){
62
-        return null;
72
+        int i = inputValue.length();
73
+        int middleC = i/2;
74
+        char c = inputValue.charAt(middleC);
75
+        return c;
63
     }
76
     }
64
 
77
 
65
     /**
78
     /**
67
      * @return the first sequence of characters
80
      * @return the first sequence of characters
68
      */
81
      */
69
     public static String getFirstWord(String spaceDelimitedString){
82
     public static String getFirstWord(String spaceDelimitedString){
70
-        return null;
83
+        String s[] = spaceDelimitedString.split(" ");
84
+        return s[0];
71
     }
85
     }
72
 
86
 
73
     /**
87
     /**
75
      * @return the second word of a string delimited by spaces.
89
      * @return the second word of a string delimited by spaces.
76
      */
90
      */
77
     public static String getSecondWord(String spaceDelimitedString){
91
     public static String getSecondWord(String spaceDelimitedString){
78
-        return null;
92
+
93
+       String s[] = spaceDelimitedString.split(" ");
94
+
95
+       return s[1];
96
+       
79
     }
97
     }
80
 
98
 
81
     /**
99
     /**
83
      * @return an identical string with characters in reverse order.
101
      * @return an identical string with characters in reverse order.
84
      */
102
      */
85
     public static String reverse(String stringToReverse){
103
     public static String reverse(String stringToReverse){
86
-        return null;
104
+     StringBuilder reversing = new StringBuilder(stringToReverse);
105
+     return reversing.reverse().toString();
87
     }
106
     }
88
 }
107
 }

+ 16
- 15
package.bluej 파일 보기

1
 #BlueJ package file
1
 #BlueJ package file
2
-editor.fx.0.height=0
3
-editor.fx.0.width=0
4
-editor.fx.0.x=0
5
-editor.fx.0.y=0
2
+editor.fx.0.height=722
3
+editor.fx.0.width=800
4
+editor.fx.0.x=240
5
+editor.fx.0.y=26
6
 objectbench.height=129
6
 objectbench.height=129
7
-objectbench.width=1171
7
+objectbench.width=622
8
 package.divider.horizontal=0.6
8
 package.divider.horizontal=0.6
9
-package.divider.vertical=0.7490774907749077
10
-package.editor.height=399
11
-package.editor.width=1069
12
-package.editor.x=59
13
-package.editor.y=63
14
-package.frame.height=600
15
-package.frame.width=1195
9
+package.divider.vertical=0.7567084078711985
10
+package.editor.height=400
11
+package.editor.width=520
12
+package.editor.x=100
13
+package.editor.y=100
14
+package.frame.height=617
15
+package.frame.width=646
16
 package.numDependencies=0
16
 package.numDependencies=0
17
 package.numTargets=6
17
 package.numTargets=6
18
 package.showExtends=true
18
 package.showExtends=true
37
 target2.width=140
37
 target2.width=140
38
 target2.x=490
38
 target2.x=490
39
 target2.y=70
39
 target2.y=70
40
+target3.association=MathUtilitiesTest
40
 target3.height=50
41
 target3.height=50
41
 target3.name=MathUtilities
42
 target3.name=MathUtilities
42
 target3.showInterface=false
43
 target3.showInterface=false
62
 target6.name=MathUtilitiesTest
63
 target6.name=MathUtilitiesTest
63
 target6.showInterface=false
64
 target6.showInterface=false
64
 target6.type=UnitTestTargetJunit4
65
 target6.type=UnitTestTargetJunit4
65
-target6.width=130
66
-target6.x=50
67
-target6.y=90
66
+target6.width=100
67
+target6.x=90
68
+target6.y=120