Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For the base public class Person example provided in the Unit 3 Revisiting the Employee Class Program tutorial, what if you need to add a
For the base public class Person example provided in the Unit Revisiting the Employee Class Program tutorial, what if you need to add a subclass for Auditors who have a host employee and are auditing a specific department of the company?
What code segment could implement this subpublic class and create an instance of it called auditor
public class Auditor extends Person
private String host;
private String department;
public AuditorString firstName,String lastName,String jobTitle,String host, String department
superfirstNamelastName,jobTitle;
this.host host;
this.department department;
public String getHost
return "Host this.host;
public void setHostString newhost
this.host newhost;
public String getDepartment
return "Department Auditing this.department;
public void setDepartmentString department
this.department department;
Auditor auditor new AuditorJohn"Doe","Auditor","Jane Doe","Information Technology";
public class Auditor extends Person
private String host;
private String department;
public AuditorString firstName,String lastName,String jobTitle,String host, String department
super;
this.host host;
this.department department;
public String getHost
return "Host this.host;
public void setHostString newhost
this.host newhost;
public String getDepartment
return "Department Auditing this.department;
public void setDepartmentString department
this.department department;
Auditor auditor new AuditorJohn"Doe","Auditor","Jane Doe","Information Technology";
public class Auditor extends Person
private String host;
private String department;
public AuditorString firstName,String lastName,String jobTitle,String host, String department
superfirstNamelastName,jobTitle,host,department;
this.host host;
this.department department;
public String getHost
return "Host this.host;
public void setHostString newhost
this.host newhost;
public String getDepartment
return "Department Auditing this.department;
public void setDepartmentString department
this.department department;
Auditor auditor new AuditorJohn"Doe","Auditor","Jane Doe","Information Technology";
public class Auditor
private String host;
private String department;
public AuditorString firstName,String lastName,String jobTitle,String host, String department
superfirstNamelastName,jobTitle;
this.host host;
this.department department;
public String getHost
return "Host this.host;
public void setHostString newhost
this.host newhost;
public String getDepartment
return "Department Auditing this.department;
public void setDepartmentString department
this.department department;
Auditor auditor new AuditorJohn"Doe","Auditor","Jane Doe","Informatio
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