Question: Programming language is java. Part 1 1. Write a method that capitalizes the first letter of each word in a sentence, named capitalizeFirstLetters. This method

Programming language is java.

Programming language is java. Part 1 1. Write a method that capitalizes

Part 1 1. Write a method that capitalizes the first letter of each word in a sentence, named capitalizeFirstLetters. This method prints a capitalized version of a String to the screen-that is, it changes the first letter of each word in the string to upper case (if it is not already upper case). So "I really enjoy attending lab!" becomes "I Really Enjoy Attending Lab!". The string to be printed should be a parameter to the method, and the method should have a void return. You should test your method in main by getting a line of input from the user and applying the method to it. public static void capitalizeFirstLetters(String input) { //TODO: parse input for words and capitalize each one. } Hint: You may want to browse the Java String docs for useful methods on strings, such as split(). Hint: You can usea new Scanner to get next() words out of a String. Hint: StringTokenizer is a class that can do the same thing. 2. Write a method called namelnitials that takes one String as argument, pertaining to somebody's full name and returns a String of the name's initials. Usage example, String initials = name Initials("Bertrand Arthur William Russell"); System.out.println(initials); //should print B.A.W.R

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Sure Lets work through both parts Part 1 Capitalize First Letters Objective Write a method capitaliz... 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 Databases Questions!