Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
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

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

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

Do we have the required resource recombination capability in-house?

Answered: 1 week ago

Question

What does corporate sustainability mean?

Answered: 1 week ago

Question

What gets printed by line 8 ? [ Figure 2 . 1 5 ] Fig 2 . 1 5

Answered: 1 week ago