Question
Java Modification 10: Write a method called addEmployee , which doesnt return a value and has 1 parameter of type Employee . It adds a
Java
Modification 10: Write a method called addEmployee, which doesnt return a value and has 1 parameter of type Employee. It adds a copy of the Employee parameter to the listOfEmployees instance variable.
Note:
You need to use the instanceof operator to cast the parameter into either HourlyEmployee or SalariedEmployee; very similar to how its done in the constructors except that youll be working with only one Employee object as opposed to an ArrayList.
The following is the method signature:
public void addEmployee(Employee employee)
{
// provide implementation
}
*****************code********************
public class Department { private int departmentID; private String departmentName; private Manager departmentManager; private ArrayList
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