Collection Framework (no legacy class/interface) Exercise:
Create an class named Employee with the following private attributes / member variables.
String name
List<Address> addressList;
Department dept
Include a 4-argument constructor.
Include getters and setters.
Include an method named printEmployeeDetails() .
Create a class named Address . Include the following private attributes / member variables.
String city
String country
Char type; //p - permanent, r means current resisdence -only two types.
Include a 3-argument constructor.
Include getters and setters.
Create a class named Department . Include the following private attributes / member variables.
List<Technology> tech;
Include a 1-argument constructor.
Include getters and setters
Create a class named Technology . Include the following private attributes / member variables.
String skillName;
Include a 1-argument constructor.
Include getters and setters.
Create another class called Example11Main. In the method, create instances of the above classes and test the above classes.
All text in bold corresponds to input and the rest corresponds to output.
Rules: only two address can be added, only one department can be added to an employee details
Sample Input and Output:
Enter the Employee name
Anbu
Do you want to add address? yes
Enter the Address type (p-permanent, r-residence):
p
Enter the city
Chennai
Enter the country
India
Do you want to add address? yes
Enter the Address type (p-permanent, r-residence):
r
Enter the city
Chennai
Enter the country
India
Do you want to add address? yes
Enter the Address type (p-permanent, r-residence):
r
Enter the city
Banglore
Enter the country
India
Do you want to add address? no
Enter the skill
Java
Do you want to add Employee? yes
Enter the Employee name
Arasu
Do you want to add address? yes
Enter the Address type (p-permanent, r-residence):
p
Enter the city
Chennai
Enter the country
India
Do you want to add address? yes
Enter the Address type (p-permanent, r-residence):
p
Enter the city
Banglore
Enter the country
India
Do you want to add address? yes
Enter the Address type (p-permanent, r-residence):
r
Enter the city
Banglore
Enter the country
India
Do you want to add address? no
Enter the skill
.NET
Do you want to add Employee? yes
Enter the Employee name
Arun
Do you want to add address? yes
Enter the Address type (p-permanent, r-residence):
p
Enter the city
Chennai
Enter the country
India
Do you want to add address? yes
Enter the Address type (p-permanent, r-residence):
p
Enter the city
Banglore
Enter the country
India
Do you want to add address? yes
Enter the Address type (p-permanent, r-residence):
r
Enter the city
Banglore
Enter the country
India
Do you want to add address? no
Enter the skill
Java
Find employees of city: Chennai
Anbu | Java
Find employees of country: India
Anbu | Java
Arasu | .NET
Arun | Java
Find employees of skill: .NET
Arasu | .NET