Question: Consider the following Java code while answering the next below questions public class Employee public class Department { private int id; private String name; private




Consider the following Java code while answering the next below questions public class Employee public class Department { private int id; private String name; private String EmpName: private long id; private Department EmpDep: public Department(int id, String name) { this.id = id; this.name = name; ) public String getName() {return name;} public void setName(String name) (this.name = name;} //line 6 1 //line 1 public Department getEmpDep() { return EmpDep; } //line 5 //line 7 } public class Test { public static void main(String[] args) { Department empDep = new Department (4,"Accounting"); // line 2 // line 3 Employee Emp2-Emp1.clone(); // line 4 }} A. Write a constructor that takes three parameters (at the line labelled //line 1) B. Using the department object from the main, create an employee object "Emp1" with name: Ahmed Abdullah and id=22 (at the line labelled //line 3) C. Write the clone method which is called at the line labelled //line 4, in the employee class (at the line labelled //line 5). D. Write the code that will print the department name for Emp1 (at the line labelled //line 4). E. Write the overriding method (toString) that will retum all the Department information (at the line labelled //line 6). F. Write the overriding method (toString) that will return all the Employee information (at the line labelled //line 7)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
