Word capitalization comes up frequently. For this assignment, compose a method called capitalize, which takes 2 String
Question:
Word capitalization comes up frequently. For this assignment, compose a method calledcapitalize, which takes 2 String parameters and returns a String.
The first parameter is the String to process (expected to be a single'word'). The second parameter indicates the capitalization mode to apply:
LOW: the output String should be in all lower cases
HI: the output String should be in all upper cases
CAP: the output String should have its first letter capitalized and the remaining letters in lower case
The second parameter can be entered with any casing but any other value beside LOW, HI, or CAP will make the method return its first parameter unchanged.
Sample Runs: System.out.println(capitalize("croCoDILe", "low"));
System.out.println(capitalize("croCoDILe", "Hi"));
System.out.println(capitalize("croCoDILe", "CAP"));
System.out.println(capitalize("croCoDILe", "mid"));
Output
crocodile
CROCODILE
Crocodile
croCoDILe