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 managerspecific 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
Maple Street
E
Engineering
Alice Johnson
Birch Lane
M
IT
Output:
Person Information:
Name: John Doe
Age:
Address: Maple Street
Employee Information:
Employee ID: E
Department: Engineering
Salary: $
Person Information:
Name: Alice Johnson
Age:
Address: Birch Lane
Employee Information:
Employee ID: M
Department: IT
Salary: $
Manager Information:
Team Size:
Bonus: $
Total Compensation: $
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
