Browse Source

second commit

Carolynn Vansant 6 years ago
parent
commit
e67b771e0b

+ 2
- 2
src/main/java/com/zipcodewilmington/danny_do_better_exercises/MathUtilities.java View File

21
      * @return sum of `baseValue` and `difference`
21
      * @return sum of `baseValue` and `difference`
22
      */
22
      */
23
     public Long add(long baseValue, long difference) {
23
     public Long add(long baseValue, long difference) {
24
-        return baseValue + difference;
24
+        return (long)(baseValue + difference);
25
     }
25
     }
26
 
26
 
27
     /**
27
     /**
182
      */
182
      */
183
     public Double divide(double dividend, double divisor) {
183
     public Double divide(double dividend, double divisor) {
184
 
184
 
185
-        return (double)(dividend - divisor);
185
+        return (double)(dividend / divisor);
186
     }
186
     }
187
 
187
 
188
 
188
 

+ 4
- 2
src/main/java/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.java View File

50
      */
50
      */
51
     public static String getSuffix(String input){
51
     public static String getSuffix(String input){
52
 
52
 
53
-        return input.substring(input.length()-2);
53
+        return input.substring(input.length()-3);
54
     }
54
     }
55
 
55
 
56
     /**
56
     /**
68
      * @return the middle character of `inputValue`
68
      * @return the middle character of `inputValue`
69
      */
69
      */
70
     public static Character getMiddleCharacter(String inputValue){
70
     public static Character getMiddleCharacter(String inputValue){
71
+        int str = inputValue.length();
71
 
72
 
72
-        return null;
73
+        return inputValue.charAt(str / 2);
73
     }
74
     }
74
 
75
 
75
     /**
76
     /**
77
      * @return the first sequence of characters
78
      * @return the first sequence of characters
78
      */
79
      */
79
     public static String getFirstWord(String spaceDelimitedString){
80
     public static String getFirstWord(String spaceDelimitedString){
81
+
80
         return null;
82
         return null;
81
     }
83
     }
82
 
84
 

BIN
target/classes/com/zipcodewilmington/danny_do_better_exercises/MathUtilities.class View File


BIN
target/classes/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.class View File