(2 Marks) Employee: Public Class Employeelist Extends Arraylist (// ..)
(2 Marks) Employee: Public Class Employeelist Extends Arraylist (// ..)
Write a class EmployeeList which extends from ArrayList (ArrayList is a collection) with the following
information :
EmployeeList Hints: to declare the EmployeeList class, you can use
the following statement:
public class EmployeeList extends ArrayList<Employee>
+getEmployeeSalaryById (int id): double
{
+getEmployeeWithMaxSalary (): Employee //…..
}
The program output might look something like this (using the EmployeeList class):
Case #1: Case #2:
Enter the number of employees:2 Enter the number of employees:2
#Employee 01 #Employee 01
Enter id:1 Enter id:1
Enter name:Tom Enter name:Tom
Enter salary:3000 Enter salary:3000
#Employee 02 #Employee 02
Enter id:2 Enter id:2
Enter name:David Enter name:David
Enter salary:3000.111 Enter salary:4039.111
1.Test getNameById() 1.Test getNameById()
2.Test getEmployeeWithMaxSalary() 2.Test getEmployeeWithMaxSalary()
Enter TC(1/2):1 Enter TC(1/2):2
Enter id:1 OUTPUT:
OUTPUT: 2,DAVID,4039.11
TOM