Question
Word capitalization comes up frequently. For this assignment, compose a method called capitalize, which takes 2 String parameters and returns a String. The first parameter
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
Step by Step Solution
3.45 Rating (148 Votes )
There are 3 Steps involved in it
Step: 1
Heres a Java method capitalize that implements the described functionality This capitalize method ta...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started