Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java A Simple Business Hierarchy The following program implements a simple inheritance hierarchy. First draw the UML showing inheritance for Employee, Manager and Executive Employee
java
A Simple Business Hierarchy
The following program implements a simple inheritance hierarchy.
First draw the UML showing inheritance for Employee, Manager and Executive
Employee class
Implement a class Employee such that a member of Employee has instance variables for name String with no blanks an ID number int an age int a salarydouble and a title String with no blanks
An Employee ID has a value of to see manager and Executive below for their ranges.
There is a default constructor with an empty body.
There is a single constructor with the name, title, ID age and salary as the parameters
Include an accessor and mutator for each field value.
Include a toString method that prints out all the attributes of the employee.
Include a method changeSalary which accepts a percentage for change as a double and changes a salary with a double argument which is the percent increase or decrease. ie
The new salary is the current salary time percent
Manager class
Implement a subclass of Employee, called Manager. A Manager ID number ranges from to
A manager also has a group of employees that heshe supervises found in an ArrayList called managedEmployees, an instance variable.
There is a single constructor which uses super with the parameters.
For managedEmployees
a Provide a mutator which adds an Employee an input parameter reference to the managedEmployees list.
b Provide an method called getManagedEmployeesListSize which returns the size of the managedEmployees list.
c Provide a method called getManagedEmployeeAtIndex with an input parameter ndex which returns a reference to the Employee at index i in the managedEmployees list.
d Override toString All you need to do is change the word employee to manager. No new variables here.
Executive class
Implement a subclass called Executive. Executive extends Manager, but an Executive only supervises an Employee who is a manager An Executive ID number ranges from to
Create an additional instance variable of type double called totalComp for an Executive which may be initialized to
There is a single constructor which uses super with the parameters.
Add a mutator method called setTotalComp with the companys profits and the bonus percentage as input values, which calculates and sets the total compensation of salary plus bonus as a double. An executive gets a bonus at the end of each year equal to a percentage of company profits.
Also include a getTotalComp method which returns the totalComp.
Override toString to include the totalComp for the Executive. Also change the word in the printout from manager to executive.
BusinessTest
Implement a class called BusinessTest which includes the main program: BusinessTest
a Has three ArrayLists called employeeAL, managerAL and executiveAL of type Employee, Manager and Executive respectively.
b Reads in the attributes of each employee from the file whose name you read in in the order previously described. Can use the file labeled emplist.txt
Aguilar Engineer
Andres Mechanic
Nishi Engineer
Agee Programmer
Choi ManagerEng
c As each employees attributes are read in the appropriate object is created based on the ID of the person. The object reference is then added to the end of the appropriate ArrayList.
d Once the results are read in assign each Employee in the employeeAL to a manager in a round robin fashion, adding a reference to the employee to the managedEmployees ArrayList for the appropriate Manager.
e Once the results are read in assign each Manager in the managerAL to an Executive in a round robin fashion.
f Prompt the user to enter the companys profits and bonus percentage. Use this to set the total compensation for each Executive.
g Create an output file and print all of the following to the output file whose name you read in The outputs are based on the interactive inputs shown below. Print to the output file:
o The total payroll for the business including bonuses.
o The attributes for each Executive, Manager and Employee as shown in the output file.
o For each Executive the direct report Managers as shown in the output file.
o For each Manager print out the direct report Employees as shown in the output file
h Read in the percent raise for the managers.
i For each manager raise the salary and then use toString to print out the new attributes only the salary has changed for each manager.
Interactive input on which the output file is based.
Please enter the name of the input file with employee name and data:
emplist.txt
Please enter the total company profit for the year: $
Please enter the executive bonus percentage for the year correct to decimal place:
Please enter the name of the output file: salesoutput.txt
Please enter the salary change for a Manager as a percentage:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started