Java : Overview You must write a class with which we can generate user identities for employees in a company. The purpose is for you to learn how to use arrays and ArrayList to store multiple values...


Java :


Overview
You must write a class with which we can generate user identities for employees in a company. The purpose is for you to learn how to use arrays and ArrayList to store multiple values of the same type.


Task
In many workplaces, employees are assigned a username to be able to log in to their computers. One method of generating these usernames is to take the first three letters of the first name and the first three letters of the last name and let them together form the username. A person with the name Sven Andersson then gets the username sveand (only lowercase letters).


Your task is to write a class named Usernames that should contain a static method named create, which creates a username as above. The method should take an array of type String as an argument, and return an ArrayList containing a string for each generated username. The array sent as an argument to the method is assumed to contain strings with the employees' names according to the form "first name last name". I.e. the first name followed by a space followed by the last name.


The ArrayList with usernames generated should have as many elements as the original array and the names should be in the same order as the elements in the original array. No checks need to be made to avoid duplicate usernames. Keep in mind that first and last names can consist of less than three letters and the username generated then contains all the letters in the first and / or last name.


The class should also include a static method called list that takes two arguments. The first argument is a String array that contains the original names (first and last names). The second argument is an ArrayList of type String and contains the generated usernames. The method should print the contents of both of these according to the form "first name last name (username)".


we have to have in our mind that some names are from 2 alphabet .


Ex how will look the output : The following is printed on the screen:
Bo Ek (boek)
Erik Edström (erieds)
Jörgen Svensson (jörsve)


Also write a test class that demonstrates all methods in the Usernames class. The array you send as an argument to create must contain at least 10 names.


MAIN .java and Maintest.java

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here