Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use java programming Q3: Given the following class Employee: public class Employee{ private int ID; private String name; privte char gender, public Employee(int myID, String

use java programming
image text in transcribed
Q3: Given the following class Employee: public class Employee{ private int ID; private String name; privte char gender, public Employee(int myID, String myName, char myGender) ID = mylD; name = myName; gender = myGender, public void setID(int myID){ID = myID;} public void setName(String myName){name = myName;} public void setGeneder(char myGender){gender = myGender;} public int getIDO{return ID:} public String getName({return name;} public char getGender({return gender:} 1. Write a class Department that keeps a record of the employees within the department in an array. It also has a name, maximum number of employees (maxEmp) and current number of employees (numEmp). This class should provide: a. A constructor to initialize the name of the department and the maximum number of employees and create an empty employees array. b. An addEmployee method that creates an employee and adds it to the employees array. (void addEmployee (int, String, char)). c. A search method that takes the id of the employee and return its index in the array employees. d. A remove method that removes an employee with a specific id from employees array and return his/her record if found, otherwise return null. (Note: shifting maybe required) e. A percentGender method that takes the gender and print the percentage of the employees of that gender to the total employees. f. A print method that prints the department name and all employees in a tabular format as shown in the sample output. 2. Write a test program Department Test. In the main do the following: a. Create a department object with name "Financial Department" and 5 as maximum number of employees. b. Display a menu of choice as in the sample output. The program should stop and exit when user enters 6. c. Check the sample output and follow it in your program. d. If the user choses 6 print the time complexity for each method: addEmployee, search, remove, and percentGender

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions