Question: please help me with this project 1. Business Model (110) A Simple Inheritance Hierarchy The following program implements a simple business hierarchy. First provide the


1. Business Model (110) A Simple Inheritance Hierarchy The following program implements a simple business hierarchy. First provide the UML for the Employee, Manager, Executive inheritance hierarchy. (10) Employee class (20) Implement a class Employee such that a member of Employee has instance variables for name (String with no blanks), a title (String with no blanks, an id number (int), an age (int), a salary(double). An Employee id has a value of 1 to 2000. The constructor accepts values for those 5 parameters in the above order and calls the corresponding mutators to set the instance values. Include an accessor and mutator for each field value. Include a method change Salary which accepts a percentage for change as a double and changes a salary with a double argument which is the percent increase or decrease. i.e. The new salary is the current salary times (1.0+ (percent/100.0)). Include a toString method that prints out all the attributes of the employee. Output would like this iftoString is used: (Note: I don't ask you to use toString for an Employee in the output) The employee name and title are Nishi Engineer The employee ID is 1987 The employee age is 33 The employee salary is $76,432.00 Manager class (15) Implement a subclass of Employee, called Manager. A Manager id number ranges from 2001 to 3000. A Manager also has an ArrayList of type Employee called managedEmployees. The constructor accepts values for the same s parameters as Employee and calls super with the values of those parameters. Method addManagedEmployee accepts a reference to an Employee and adds it to the managedEmployees ArrayList. The return value is void Method get ManagedEmployees ListSize has no parameters and returns the size of the managedEmployees list. Method getManagedEmployee with an input parameter i which returns a reference to the Employee at index i in the managedEmployees ArrayListist. Override toString. All you need to do is change the word employee to manager. No new variables here. Output would like this if toString is used: The manager name and title are Choi Managerling The manager ID is 2309 The manager age is 34 The manager salary is $108431.78 Executive class (15) 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 3001 to 3500, Create an additional instance variable of type double called totalComp for an Executive which may be initialized to 0.0. The constructor accepts values for the same 5 parameters as Employee and calls super with the values of those parameters Add a mutator method called set TotalComp with the company's 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. Modify the toString method to include the totalComp. Override toString to include the totalComp for the Executive. Also change the word in the printout from manager to executive. Output would like this if toString is used: (Note: I don't ask you to use toString for an Employee in the output) The executive name and title are Silva Exess The executive ID is 3119 The executive age is 42 The executive salary and total compensation are $174.763.00 and $240.534.30 Business Test class (50) Implement a class called Business Test which includes the main program: The main method: a. Has three ArrayLists called employeeal, managerAL and executive AL, 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 - name, title, id, age, salary. (In Project Solutions/Project 5 tab you will find the file emplist.txt which you can use.) Note. Use next not nextLine for Strings c. As each employee's attributes are read in the appropriate object is created based on the id of the person. (Employee if 1-2000, Manager if 2001 to 3000, Executive if 3001 to 3500). 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. (Note - Round Robing means assign to Managers in order and after the last one go back to the first one). e. Once the results are read in assign each Manager in the manager AL to an Executive in a round robin fashion f. Prompt the user to enter the company's profits for the year 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. (See employeeoutput.txt which is included in the Project Solutions/Project 5 tab.) The outputs are based on the interactive inputs shown below. Print to the output file: 1. The total payroll for the business including bonuses. 2. The attributes for each Executive, Manager and Employee as shown in the output file. 3. For each Executive the direct report Managers as shown in the output file. 4. 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: $876924 Plense enter the executive bonus percentage for the year correct to 1 decimal place: 7.5 Please enter the name of the output file: employecoutput.txt Please enter the salary change for a Manager as a percentage: 3.5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
