Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Description and Given Info Write a public static method named nameToInitials that will take a single argument of type String and will return a

image text in transcribed

Problem Description and Given Info Write a public static method named nameToInitials that will take a single argument of type String and will return a String. When called, and passed a name, this method must compute and return a String value with the initials for the given name. Here are some examples showing what the value returned by your nameToInitials method should be for different argument values: nameToInitials ("Bob Allen Smith") should return the String value "B. A. S." nameToInitials ("Bob Smith") should return the String value "B. S." nameToInitials ("Bob") should return the String value "B." Note that the argument to this method may be a String containing just a first name (i.e. "Bob"), just first name and last name (i.e. "Bob Smith"), or the first name and middle name and last name (i.e. "Bob Allen Smith"). You must also write a small program in the main method that will: 1. prompt the user to enter a name 2. collect and store the user's input in a String variable 3. call the name ToInitials method, passing the user's input as an argument 4. store the value returned by the nameToInitials method in another String variable 5. Display the name and initials as shown in the examples below Example 1 Enter name : Bob Allen Smith Initials for Bob Allen Smith : B. A. S. Example 2 Enter name : Bob Smith Initials for Bob Smith : B. S

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

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

Explain some provisions of the Master Settlement Agreement.

Answered: 1 week ago

Question

=+ What typical employee will the IA compare him/

Answered: 1 week ago

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago