Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

14. (7 marks) Consider the classes Person and EmployeeRecord, iven below. Identi

ID: 3915549 • Letter: 1

Question

14. (7 marks) Consider the classes Person and EmployeeRecord, iven below. Identify and fix any shallow returns which may occur. Also, write an appropriate copy constructor for the EmployeeRecord class. public class Person t public elass EnployeeRecord pzivate string firstName private string lastName private Person enployee: private int employeelDs public Person (String fName, String 1Name) public EmployeeRecord (Person e, int ID setName (EName, Name) this.employee -e employeelD ID publia void setName (String fName, String 1Name) publie void setinto (Person,int ID) this.firstName -fName this.lastName 1Name this.employee employeeID ID publie string getFirstName ) publie Person getEmployee) return firstName return employee public String getLastName ) publio int get1DO return lastName : return employeeID

Explanation / Answer

Copy constructor: -------------------- public EmployeeRecord(EmployeeRecord record) { this.employee = new Person(record.employee.getFirstName(), record.employee.getLastName()); this.employeeID = record.employeeID; }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote