Question: 2. Create parent class Employee with attributes: id, name, basic salary and address. Add one abstract method as calculateSalary in this class. Create child classes:

 2. Create parent class Employee with attributes: id, name, basic salary

2. Create parent class Employee with attributes: id, name, basic salary and address. Add one abstract method as calculateSalary in this class. Create child classes: Manager and Consultant from Employee class. For Manager, gross salary will include 10% of basic as HRA and 15% of basic as DA apart from basic salary. For consultant, there will be one more attribute in the class as consultant fees. Gross salary will include this fees and 50% of basic as DA apart from basic salary. >Create class Organization with ArrayList of type Employee. >Add a method to add new Employee. >From test method, create object of class Organization and add few Consultants and Managers. >Display gorss salary for all employees. >Add method in Organization class which will compute average gross salary for all employees. Test this method from test method

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 Mathematics Questions!