Question: Create a Simple Java program following the below instructions: A)Store your name (first and last together separated by one space ie. Mary Flower) in a

Create a Simple Java program following the below instructions:

A)Store your name (first and last together separated by one space ie. "Mary Flower") in a String object referenced by the reference variable myFullName.

B) Display myFullName in all upper case, display myFullName in all lower case, and next display the original myFullName.

C) Display the number of characters in the myFullName object (ie. My name is Mary Flower and it is 11 characters long)

D) Extract the first name from the myFullName object and store it in the myFirstName String object (utilize indexOf method to compute index of space and use this information in the call to substring)

E) Extract the last name from the myFullName object and store it in the myLastName String object (use a similar technique as above)

F) Display myLastName followed by comma followed by myFirstName (ie. My inverted name is Flower,Mary)

G) Store your friend's name (first, middle, and last together separated by one space ie "John Henry Smith") in a String object referenced by the reference variable friendsFullName.

H) Display number of characters in the friendsFullName object (ie. My friend's name is John Henry Smith and it is 16 characters long)

I) Extract the first name initial from the friendsFullName object and store it in the friendsFirstNameInitial char

J) Extract the last name initial from the friendsFullName object and store it in the friendsLastNameInitial char (utilize lastIndexOf method to get the index of the last space)

K)Display a message showing yours and your friend's initials (ie. MF and JS are friends)

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!