Employee Information System
An organization keeps pay scale data about each employee in its database. One of the purposes is to calculate income tax for each employee. Each Employee contains the following details:
Employee Class
Fields:
Employee ID (int)
Name (String)
basic, hra, da (int)
manager (Employee) - This field points to the manager for this employee. Each employee is assumed to report to only one manager.
Constructors:
Employee()
Employee(int id, String name)
Methods:
get/set methods
int calculateMonthlySalary()
int calculateYearlySalary()
int calculateIncomeTax()
String toString()
Manager Class
Inherit a class Manager from Employee. It has the following additional information
Fields:
totalReportees (int) - Number of people who are reporting to this supervisor. This number can be anywhere between 0 and 5, both inclusive.
Employee[] reportees - An array of Employee objects who report to this supervisor. Assume that each manager has a maximum of 5 direct reportees.
Constructors:
get/set methods
Manager ()
Manager (int id, String name)
Methods:
void addReportee(Employee)
print() - To display the details of the manager
print(level) - Print the reportees starting from this manager in a tree fashion. Prefix a '*' to the name of the manager, if he has employees reporting to him
Algorithms:
monthly salary = (basic + hra + da)
yearly salary = monthly salary * 12
if (salary less than 100000)
no tax
if salary between 100000 - 500000
tax is 20 % of amount above 100000
if salary above 500000
tax is 20 % of amount above 100000 and below 500000, and 40 % of amount above 500000
If this manager already has 5 reportees, print an error message and do not add the new reportee.
Remember that a Manager may have other managers as reportees, there by creating a tree-like employee reporting structure.
Following is an example of output of printTree() method of Manager Class:
If Paul and Henry report to Nick. John reports to Paul. Calvin and Smith report to Henry. Then the tree will look like:
*Nick
*Paul
John
*Henry
Calvin
Smith
The setManager() method should also add the current object as a reportee for the manager
print() - To display the details of the employee along with monthly and yearly salary