Name format: You must use String object and not StringBuffer or StringBuilder. Many documents use a specific format for a person's name. Write a program that take one Line as an input. Example: Scanner input = new Scanner(System.in); System.out.printIn(“Enter firstName middleName lastName separated by at least one blank, It may have more than one blank separating firstName middleName lastName."); Input sample : Pat Silly Doe || Note these are separated by at least one blank. String line = input.nextLine() Ex: If the input is: Pat Silly Doe the output is: Doe, P.S. If the input has the form: firstName lastName the output is: lastName, firstInitial. Ex: If the input is: Julia Clark the output is: Clark, J. Please submit the java source file and the sample run in a text file. Thanks

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question
Name format: You must use String object and not StringBuffer or StringBuilder.
Many documents use a specific format for a person's name. Write a program that take one
Line as an input.
Example:
Scanner input = new Scanner(System.in);
System.out.println(“Enter firstName middleName lastName separated by at least one
blank, It may have more than one blank separating firstName middleName lastName.");
Input sample : Pat Silly Doe || Note these are separated by at least one blank.
String line = input.nextLine()
Ex: If the input is:
Pat Silly Doe
the output is:
Doe, P.S.
If the input has the form:
firstName lastName
the output is:
lastName, firstInitial.
Ex: If the input is:
Julia Clark
the output is:
Clark, J.
Please submit the .java source file and the sample run in a text file. Thanks
Transcribed Image Text:Name format: You must use String object and not StringBuffer or StringBuilder. Many documents use a specific format for a person's name. Write a program that take one Line as an input. Example: Scanner input = new Scanner(System.in); System.out.println(“Enter firstName middleName lastName separated by at least one blank, It may have more than one blank separating firstName middleName lastName."); Input sample : Pat Silly Doe || Note these are separated by at least one blank. String line = input.nextLine() Ex: If the input is: Pat Silly Doe the output is: Doe, P.S. If the input has the form: firstName lastName the output is: lastName, firstInitial. Ex: If the input is: Julia Clark the output is: Clark, J. Please submit the .java source file and the sample run in a text file. Thanks
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Methods of StringBuilder class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,