Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 0 3 : Get Acronym Method Description getAcronym ( String ) : String A public static method that when called and passed a `

Part 03: Get Acronym
Method Description
getAcronym(String) : String 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.
doGetAcronym(Scanner) Partially provided in template and called by the menu, which provides a Scanner object. Remove the placeholder message.
Then implement the following functionality:
prompt the user to enter some words
collect and store the user's input in a `String` variable
call the `getAcronym` method, passing the user's input as an argument
store the value returned by the `getAcronym` method in another `String` variable
Display the name and acronym as shown in the examples below
Here are some examples showing what the value returned by your `getAcronym` method should be for different argument values:
Example 1
Enter some words : fear of missing out
Acronym for fear of missing out : FOMO
Example 2
Enter some words : self contained underwater breathing apparatus
Acronym for self contained underwater breathing apparatus : SCUBA
For the given inputs, make sure that your program output looks exactly like the example above (including spelling, capitalization, punctuation, spaces, and decimal points).

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

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

Check my work Equivalent Units of Production (EUP)

Answered: 1 week ago

Question

Explain Coulomb's law with an example

Answered: 1 week ago

Question

What is operating system?

Answered: 1 week ago

Question

What is Ohm's law and also tell about Snell's law?

Answered: 1 week ago

Question

Describe the new structures for the HRM function. page 676

Answered: 1 week ago