Write a Java program that demonstrates polymorphism using an…
Write a Java program that demonstrates polymorphism using an employee class hierarchy. Use following classes public class Employee { String name; public Employee(String name) { this.name = name; } public double calculateSalary() { return 0; } } public class FullTimeEmployee extends Employee { double monthlySalary; public FullTimeEmployee(String name, double monthlySalary) { super(name); this.monthlySalary = monthlySalary; } @Override public double calculateSalary() { return monthlySalary; } } public class PartTimeEmployee extends Employee { int hoursWorked; double hourlyRate; public PartTimeEmployee(String name, int hoursWorked, double hourlyRate) { super(name); this.hoursWorked = hoursWorked; this.hourlyRate = hourlyRate; } @Override public double calculateSalary() { return hoursWorked * hourlyRate; } } Write the main method using following guidelines: Create an ArrayList Add at least: One FullTimeEmployee object Two PartTimeEmployee objects Use a loop to: Call calculateSalary() for each employee Display the employee’s name and salary The Output should look like Ali Salary: 5000.0Sara Salary: 1200.0John Salary: 800.0