Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q3. Using class Employee you implemented in Homework 1, write a class Department that keeps a record of the employees within the department in an
Q3. Using class Employee you implemented in Homework 1, write a class Department that keeps a record of the employees within the department in an array. It has the following instance variables: name maximum number of employees (maxEmp) current number of employees (numEmp) Array of employees. This array is used to store current employees information This class should provide: A constructor to initialize the name of the department and the maximum number of employees and create an empty employees array. An addEmployee method that creates an employee and adds it to the employees array. (boolean addEmployee (String, int, double)). A search method that takes the id of the employee and return its index in the array employees. A shift method that takes one argument which specifies the starting index where the array element should be shifted. This method shifts an array starting at location i to the left by 1. (void shift (int)) A remove method that removes an employee with a specific id from employees' array and return his/her record if found, otherwise return null. Use the shift method. (Employee removeEmp(int)). A print method that prints the department name and all employees in a tabular format as shown in the sample output. Write a test program Department Test. In the main do the following: Create a department object with name "Human Resources" and 3 as maximum number of employees. Display a menu of choice as in the sample output. The program should stop and exit when user enters 5. Check the sample output and follow it in your program. If the user choses 4 (exit), prints the time complexity for each method NOTE: if your Employee class implementation has some errors, fix them first. Ask the TA or other students for help. If you were helped by a student to fix your Employee class, mention the student name as a comment in your class
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