Question: You are to write a base class Person with the following attributes: name ( String ) age ( int ) address ( String ) Next,

You are to write a base class Person with the following attributes:
name (String)
age (int)
address (String)
Next, create a derived class Employee with the following additional attributes:
employeeID (String)
department (String)
salary (double)
Finally, create a further derived class Manager that extends Employee with the following additional attributes:
teamSize (int)
bonus (double)
Within the Employee class, override the printInfo() method from the Person class to include the employee attributes.
In the Manager class, further override the printInfo() method to include the manager-specific attributes.
In the Manager class, implement a method calculateTotalCompensation() that returns the sum of the manager's salary and bonus.
Example:
If the input is:
John Doe
30
123 Maple Street
E12345
Engineering
85000.00
Alice Johnson
40
789 Birch Lane
M67890
IT
95000.00
5
10000.00
Output:
Person Information:
Name: John Doe
Age: 30
Address: 123 Maple Street
Employee Information:
Employee ID: E12345
Department: Engineering
Salary: $85,000.00
Person Information:
Name: Alice Johnson
Age: 40
Address: 789 Birch Lane
Employee Information:
Employee ID: M67890
Department: IT
Salary: $95,000.00
Manager Information:
Team Size: 5
Bonus: $10,000.00
Total Compensation: $105,000.00

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