Browse Source

completed remaining functions

Garrett Arant 6 years ago
parent
commit
6864833138

+ 6
- 1
src/main/java/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.java View File

67
     public static Character getMiddleCharacter(String inputValue)
67
     public static Character getMiddleCharacter(String inputValue)
68
 
68
 
69
         {
69
         {
70
-            
70
+            //Find length of the word
71
+            int lengthOfWord= inputValue.length()-1;
72
+            //Divide the length by 2, account for even;
73
+            int middleLengthOfWord= (int)(Math.floor(lengthOfWord/2));
74
+            return inputValue.charAt(middleLengthOfWord);
75
+
71
         }
76
         }
72
 
77
 
73
     /**
78
     /**

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


BIN
target/test-classes/com/zipcodewilmington/danny_do_better_exercises/TestStringUtilities.class View File