In: Computer Science
Kids R Us Child Care Centers is creating an online parent portal that parents will access with a username and password. Use a formula to create a username for each parent based on the following rules: • Lowercase first letter of first name. • Digit five of ID. • Uppercase first four letters of last name. • Last digit of phone number. • Number of characters in first name
Please show the formula used
Parent ID | Parent Last Name | Parent First Name | Parent Phone | Parent Username |
100000 | Ewing | Levi | (550) 726-7424 | |
100001 | Gillespie | Vera | (263) 579-3567 | |
100002 | Mccall | Astra | (897) 263-3526 | |
100003 | Woodward | Constance | (845) 953-5717 | |
100004 | Duke | Keaton | (289) 465-5356 | |
100005 | Stephenson | Alana | (693) 335-3919 | |
100006 | Guzman | Cally | (836) 183-4738 | |
100007 | Zimmerman | Flavia | (590) 994-9083 | |
100008 | Cooper | Jameson | (373) 497-3310 |
class UserName
{
public static void main(String [] args)
{
String UserName=""; //Initializing the string UserName with empty string.
String ParentFirstName="Gillespie";
String ParentLastName="Vera";
String ParentID="100001";
String ParentPhone="(263)579-3567";
UserName+=ParentFirstName.toLowerCase().charAt(0); //Adding Lower case first letter of firstname
UserName+=ParentID.charAt(4); //Adding fifth digit of ID
UserName+=ParentLastName.toUpperCase().substring(0,4);//Adding Uppercase first 4 letters of lastname
UserName+=ParentPhone.charAt(ParentPhone.length()-1); //Adding last digit of phone number
UserName+=ParentFirstName.Length(); //Adding number of characters in first name.
System.out.println("User Name is : "+UserName);
}
}
Output: