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
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