Problem Statement:
You need to design an Employee Management System that includes different types of employees, such as
full-time and contract employees.
All employees share some common characteristics, but their salary calculations differ.
Some employees are eligible for benefits, while others are not.
Your task is to:
1. Define an abstract class Employee that serves as the base class.
2. Implement the Payable interface to define how salary is calculated.
3. Create concrete subclasses (FullTimeEmployee and ContractEmployee) that extend Employee
and implement Payable.
4. Test the system in a Main class.
Step 1: Create an Abstract Class Employee
The Employee class should:
Have attributes: name, id, baseSalary.
Include a constructor to initialize common attributes.
Have an abstract method calculateSalary() to be implemented in subclasses.
Implement a concrete method displayEmployeeInfo() that prints employee details.
Step 2: Create the Payable Interface
The Payable interface should declare a method getPaymentAmount() that all employee types must
implement.
Step 3: Create FullTimeEmployee Class
A full-time employee:
Has benefits, so they receive an extra 20% of base salary.
Implements calculateSalary() method accordingly.
Step 4: Create ContractEmployee Class
A contract employee:
Does not receive benefits.
Is paid based on a fixed hourly rate and hours worked.