Question: In java Make an Abstract class Employee with a name and monthly salary. Make a class Manager Inherit from Employee. Add and instance variable,named department,

In java

Make an Abstract class Employee with a name and monthly salary.

Make a class Manager Inherit from Employee. Add and instance variable,named department, of type String

Make a class Executive inherit from Manager

Make a regular class that inherits from Employee.

It should also include an abstract method calculateBonus() as shown below:

abstract public int calculateBonus();

According to the following rules:

A Managers bonus is calculated by multiplying his salary by 2.

An Executive's bonus is calculated by multiplying his salary by 3.

A Regualrs bonus remains unchanged.

Supply a test program that tests these classes and methods. Your test should also create objects of each type , add them to an ArrayList and use that ArrayList to demonstrate dynamic Polymorphism.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!