Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A public static method that when called and passed a ` String ` must compute and return a ` String ` value that contains just

A public static method that when called and passed a `String` must compute and return a `String` value that contains just the capitalized first letter of each word.
Note: the arguments to this method will always be a `String` containing one or more words, and the words will always be separated by a single space character, and a space character will always be followed by another word.
Hints:
The `indexOf` method can be very helpful for finding things like space characters in a `String`
Java has an overloaded `indexOf` method with takes an extra `int` argument indicating where to start a search in a `String`
Java also has an `lastIndexOf` method, which searches a `String` starting at the end.
The `substring` method can be very helpful for extracting one or more characters from a `String`
You may need to write some code to make decisions based on whether the input has one (just first), two (first and last), or three (first, middle, and last) names.
A loop will definitely be useful.
It can be helpful to know and understand the difference between the `Scanner` methods `next` and `nextLine`
The Java `String` class include a method named `toUpperCase` that may also be useful.

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_2

Step: 3

blur-text-image_3

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