Question: Polymorphism is the ability for objects to have many different forms which helps to provide a more manageable code. Based on the following cases, provide
Polymorphism is the ability for objects to have many different forms which helps to provide a more manageable code. Based on the following cases, provide the solution using the concept of polymorphism:
(a) A Lecturer and a lab assistant is an Employee of a university. All Employee objects will have a fixed salary and on top of that, a Lecturer will have additional fixed allowance allocated, while a lab assistant will have an overtime claim of RM20 per hour. Define all these THREE (3) classes and provide the methods to calculate the monthly income for Lecturer and lab assistant. Define a static method in Employee class to calculate the total income paid to all employees. (15 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
