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

1 Expert Approved Answer
Step: 1 Unlock

Heres a Java method capitalize that implements the described functionality This capitalize method ta... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!