i need this java code kindly follow the instructions and give the same ouput. i attached 2 picutres below to start the program kindly follow that.
Write a program to do the following: Prompt for input of someone's first, middle, and last name as a single string (using any combination of upper and lowercase letters). . Check to make sure the name was entered in the correct format (3 names separated by a single space). If the input is not correct, continue to request the input again until the format is correct. If the user inputs any spaces in front of or behind the input string, ignore that white space and continue to process the input. Prompt for input of someone's phone number in 10 digit form (for example: 5188284181). If the input is not exactly 10 digits, continue to request the input again until the format is correct. o Capitalize only the first letters of each part of the name, and print out the revised name. Print out the initials for that name. Print out the name in the format of: Lastname, Firstname, MI. (for example: Smith, John A.). Print out the phone number with parentheses, a space, and a dash. For example: (518) 828- 4181. Note: You must use the substring method, and you cannot utilize arrays or use StringTokenizer to accomplish this. Use the Assignments.java file above as a starting point. You only need to fill in the code within each method (except for the main method, which should remain as is). Use the Assignment5.java file above as a starting point. You only need to fill in the code within each method (except for the main method, which should remain as is). Your output must resemble the samples below. Command Prompt Enter your "First Ride to waith Enter 10 digit phone number ok S159450912): 518828181 you entered: John Jacobsen our initials are JS Bioplayed with lest nase First Sat, Jan our phone number i 12-18 Command Prompt Enter your "Fire Rele Last JO CON RATH Enter 18 digit phone number ( 5535491222 ou entered: Jachtaith our initials are 1 Bioplayed with lateret taith, Command Prompt w your ist Mit Last Enualsdanput Enter your nees "First siste Last John Jacob Sasth!! Emelid input Enter your mes First Last fasth EN 10 digit phone nuter cex 51525315 51632841 Enufficient length plene reenter Ne 18 digit phone number: 515358812) 51612001615 Feesany digits - please enter Enter 10 digit whene ruher S1512391621 hone number must be allegata - piese penter Enter 10 digit phone number cex 51SNES123 370328181 you entered John Jacob Smith Your intials are JB Your phone nuther le Command Prompt Enter your name as 'First Middle Last: john jacob saith Enter 10 digit phone number cex: 5153458912>5188284181 you entered: John Jacob Seith Your initials are JJS Displayed with last name first: Smith, John J. Your phone number 18: 828-4181 1 Command Prompt Enter your name ="First Middle Last John Invalid input Enter your name as "First Hiddle Last': John Jacob Invalid input Enter your name as 'First Hiddle Last John Jacob Saith II Invalid input Enter your name as 'First Middle Last: John Jacob Saith Enter 10 digit phone number ex: 5153458912) 51882841 Insufficient length - please reenter Enter 10 digit phone number (ex: 5153458912: $1802041815 Too many digits . please reenter Enter 10 digit phone number cex: 5153456$12) 518a284181 Phone number must be all digito - please reenter Enter 10 digit phone number (ex: 5153450912) 5188284181 You entered: John Jacob Saith Your initials are: JJS Displayed with last name first: Saith, John J. Your phone number is: } import java.util.Scanner; public class Example { public static void main(String[] args) { Scanner input = new Scanner(System.in); String aString; boolean good = false; while( !good) { System.out.print("Enter a string: "); aString input.nextLine(); if(aString.length() == 0) System.out.println("Invalid input"); else good = true; } } }