Question: You are required to use String manipulation to generate an employees initial values when they are added to the system. The program will ask for
You are required to use String manipulation to generate an employees initial values when they are added to the system.
The program will ask for their name and then generate the following values based on the information provided:
1)Username:june.summers lowercase firstname(dot)lastname
2)Email address:jsummers@yahoo.Test first initial and surname followed by the email suffix
3)Password:J*l**.s* -8-character complex password (Uppercase and lowercase characters as well as special characters(*)).
Create a class named AccountGeneratorthat has a main method and variables to store the text values for the name, username and email as well as the changeable value for the password.
Create a Scanner object to read in values from the console.
Create three variables that will store the employees initial values. Name the variables name, usernameandemail.
Create a DisplayInfo()method that will produce the following output:
Employee Details
Name : Julie Summers
Username : julie.summers
Email : jsummers@yahoo.Test
Create a method named countChars that will accept a String and a char as parameters and will count the number of times the char appears in a String. Use a for loop to iterate through the String and return the count of characters to the calling method.
Create a setName method that accepts no parameters and returns a String value for the name. Create a count variable that will store the return value from the countChars method and a Scanner object to read in values from the console. Use a do whileloop to read in the users name until they provide a first and second name (one space inbetween). Send the name and a space character to the charCounts method and exit the loop when there is a single space in the name.
Create a setUserName method that accepts the String name as a parameter and returns the formatted username. The username should be lowercase and have a dot (.) instead of a space separating the first and last names.
Create the setEmail method that accepts the usernameas a parameter and returns the formatted email address. The email address is made up of the first name followed by the complete surname followed by the email address suffix (@yahoo.Test).
Display the value to the console using the displayInfo method
Close the Scanner object when you are finished with it.
Test your code with a variety of usernames.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
