Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program to demonstrate string manipulation. You will need to use a variety of string methods. Using Scanner method nextLine( ) ONLY ONCE
Write a program to demonstrate string manipulation. You will need to use a variety of string methods. Using Scanner method nextLine( ) ONLY ONCE Rule: THERE WILL BE NO USE OF next() ALLOWED - NEGATIVE 5 marks if it's used No flow chart required for this assignment. Input a name in the format Title, First name, Last name (i.e. Mr. John Smith, Ms. Annie Buddy). Output the name in the following formats in the following order: a) Original input (ie. Mr. John Smith) b) First name Last name (ie John Smith) c) Last name, First name (ie. Smith, John) d) Title Last name (ie. Mr. Smith) e) Last Name, Initial (ie. Smith, J.) The challenge here is to use as many built in methods within the string class to make this sequential code as streamlined as possible! Rule: You cannot reach ahead and use arrays and split command here - that is working around the emphasis on string manipulation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started