0% found this document useful (0 votes)
2 views2 pages

Problem Statement About Abstract Interface

Uploaded by

mthienphu563
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Problem Statement About Abstract Interface

Uploaded by

mthienphu563
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Problem Statement: Design an Abstract Class and Interface for an HR

Management System

You are designing a Human Resource Management System (HRMS) that handles different
types of employees, including full-time employees and contract employees. The system should
define a common structure for all employees while allowing flexibility for different employment
types.

Requirements:

1. Define an interface (Employee) that includes:


o void work();
o double calculateSalary();
o void generateReport();
2. Create an abstract class (AbstractEmployee) that implements the Employee interface
and provides:
o Common attributes such as name, employeeID, and department.
o A method for displaying employee details.
o An abstract method getEmploymentType(); that must be implemented by
subclasses.
3. Implement concrete classes (FullTimeEmployee and ContractEmployee) that extend
AbstractEmployee:
o FullTimeEmployee: Fixed monthly salary, eligible for benefits.
o ContractEmployee: Hourly wage, no benefits.

Objective:

 Use an interface to define a contract for all employees.


 Implement an abstract class to provide shared attributes and methods.
 Apply inheritance and polymorphism for specialized employee types.

Problem Statement: Multi-Inheritance using Interface and Abstract Class in


Java

You are designing an HR Management System where employees have different roles and
responsibilities. Some employees, like managers, have administrative duties in addition to
regular work. Since Java does not support multiple inheritance with classes, we need to achieve
it using interfaces and an abstract class.

Design Requirements:

1. Define an interface (Workable) that includes general employee responsibilities:


o void work();
o double calculateSalary();
2. Define another interface (Manageable) for employees who have managerial duties:
o void conductMeeting();
o void evaluatePerformance();
3. Create an abstract class (Employee) that
implements the Workable interface and
provides:
o Common attributes like name, employeeID, and department.
o A method to display employee details.
o An abstract method getEmploymentType(); for subclass implementation.
4. Implement concrete classes (Developer and Manager):
o Developer extends Employee and adds some fields: experience and full-stack
implements

work() : if is full-stack and experience>=5 then display “do senior’s tasks”, else
display “do fesher’s stacks”

calculateSalary(): display salary, salary=1.5*experience * 10000

o Manager extends Employee and also implements Manageable, adding


administrative responsibilities.
o And implements:

Void work(): display “do manager’s tasks”

Void calculateSalary():display salary, salary=2.5*20000

void conductMeeting(); display “meeting online in 25/2/2025 by the link …”

void evaluatePerformance(): if responsibilities is administrative then display “CEO”, else “CTO”

Objective:

 Use multiple interfaces to simulate multiple inheritance.


 Implement an abstract class for shared behavior and attributes.
 Demonstrate how a class can implement multiple interfaces while extending an abstract
class.

You might also like