Question: * In Java with the simplest code you can, i.e., no while loops, please. Design and write a program that take as in input, a

* In Java with the simplest code you can, i.e., no while loops, please.

Design and write a program that take as in input, a proper name. You can safely assume that a proper name will always consist of exactly three parts - a first name, a middle name, and a last name - separated by spaces. Your program must collect and store this full proper name in a String variable. Your program must then compute and store the following components in separate String variables:

total characters in the proper name (not including the spaces)

first name

middle name

last name

first initial (first letter of first name)

middle initial (first letter of middle name)

last name first (for example, for the proper name Bob Jones Smith, last name first would be Smith, Bob Jones)

short form (for example, for the proper name Bob Jones Smith, short form would be B. J. Smith)

Finally, your program must output the required information.

Here are some examples of what the user should see when the program runs.

Example 1

Enter a proper name : Grace Murray Hopper Total characters : 17 First name : Grace Middle name : Murray Last name : Hopper First initial : G Middle initial : M Last name first : Hopper, Grace Murray Short form : G. M. Hopper 

Example 2

Enter a proper name : Alan Mathison Turing Total characters : 18 First name : Alan Middle name : Mathison Last name : Turing First initial : A Middle initial : M Last name first : Turing, Alan Mathison Short form : A. M. Turing 

For the given inputs, make sure that your program output looks exactly like the example above (including spelling, capitalization, punctuation, and spaces).

Hints

Make good use of String methods like:

length

indexOf

lastIndexOf

substring

charAt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!