Question Answered step-by-step import java.util.ArrayList; import java.util.List; public class… Image transcription text- Copy Lab 8-lnheritance and paste it to LabQ-Polymorphism. – Change the Tester for this week’s lab. In it: -Create an array of Employee objects. – Initialize two of the objects in the array to Employee objects. – Set thethird object in the array to your Manager object. – Use a regular for loop to call the toString metho… Show more… Show moreimport java.util.ArrayList;import java.util.List;public class Main { private static final List employees = new ArrayList<>(); public static void main(String[] args) { employees.add(new Employee(“Harry Hacker”, 50000.0, “1/10/2010”, 0.0)); employees.add(new Employee(“Tommy Tester”, 40000.0, “15/3/2012”, 0.0)); employees.add(new Manager(“Carl Cracker”, 80000.0, “15/1/2007”, 0.0)); System.out.println(“Employees before raise”); System.out.println(“—————————“); printAllEmployees(); addBonusToEmployees(); System.out.println(); System.out.println(“Employees after 10% raise”); System.out.println(“—————————“); printAllEmployees(); System.out.println(); System.out.println(“Yippy!!! Manager gets bonus”); System.out.println(“—————————“); addBonusToManagers(); printAllEmployees(); } private static void addBonusToManagers() { for(Employee emp : employees) { if(emp instanceof Manager) { emp.setSalary(5000.0); } } } private static void printAllEmployees() { for(Employee emp : employees) { System.out.println(emp); } } private static void addBonusToEmployees() { for(Employee emp : employees) { emp.setIncreaseSalaryPercentage(10.0); } }}——————————————————————————————————————————————–public class Employee { private String fullName; private double salary; private String dateHired; private double increaseSalaryPercentage; public Employee(String fullName, double salary, String dateHired, double increaseSalaryPercentage) { this.fullName = fullName; this.salary = salary; this.dateHired = dateHired; setIncreaseSalaryPercentage(increaseSalaryPercentage); } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary += salary; } public String getDateHired() { return dateHired; } public void setDateHired(String dateHired) { this.dateHired = dateHired; } public double getIncreaseSalaryPercentage() { return increaseSalaryPercentage; } public void setIncreaseSalaryPercentage(double increaseSalaryPercentage) { if(increaseSalaryPercentage > 0.0) { double bonus = salary * (increaseSalaryPercentage / 100); this.salary += bonus; } this.increaseSalaryPercentage = increaseSalaryPercentage; } @Override public String toString() { return “Name: ” + fullName + ” is hired on ” + dateHired + “, Salary: ” + salary; }}——————————————————————————————————————————————–public class Manager extends Employee { public Manager(String fullName, double salary, String dateHired, double increaseSalaryPercentage) { super(fullName, salary, dateHired, increaseSalaryPercentage); } @Override public String toString() { return super.toString(); }} Computer Science Engineering & Technology Object-Oriented Programming CPAN 131 Share QuestionEmailCopy link Comments (0)