Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you please help me with the code of this in Java!? Part 1 1. Write a method that capitalizes the first letter of each

Could you please help me with the code of this in Java!?
image text in transcribed
image text in transcribed
image text in transcribed
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 in put) ( TODO: parse input for words and capitalize each Hint: You may want to browse the Java String docs for useful methods on strings, such as splito. Hint: You can usea new Scanner to get next0 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 nameInitials ("Bertrand Arthur wi lian Russell"): System.out print In(initials): //should prin t B.A... 3. Write a method called letterCount that takes two String arguments, one containing some text and the other containing a single letter. This method should then compute and return the count of all of the occurrences of that letter in the given text. Usage example, int countMs; countMs letterCount("I an the very model of a mod ern major general, System.out print In(countMs) //should print 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Question What is a Roth 403 (b) plan?

Answered: 1 week ago