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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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)".

Ex) If we have the following array and send it as an argument to the method according to:
String [] names = ;

; ArrayList <String> usernames = Usernames.create (names); Usernames.list (names, userNames);

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.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY