Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For the subpublic class Employee of the base public class Person example provided in the tutorial, what if you need to keep track of the
For the subpublic class Employee of the base public class Person example provided in the tutorial, what if you need to keep track of the department for each employee.
What code segment could be used to properly initialize, and add methods to set and get this value?
a
public class Employee extends Person
private int employeeId;
private double salary;
private String department;
public EmployeeString firstName,String lastName,String jobTitle,double sal,int empId,String department
superfirstNamelastName,jobTitle;
this.employeeId empId;
this.salary sal;
this.vacationDaysPerYear ;
this.vacationDays this.vacationDaysPerYear;
this.department department;
public void getDepartmentdepartment
return "Department: department;
public String setDepartment
this.department department;
b
public class Employee extends Person
private int employeeId;
private double salary;
private String department;
public EmployeeString firstName,String lastName,String jobTitle,double sal,int empId,String department
superfirstNamelastName,jobTitle, department;
this.employeeId empId;
this.salary sal;
this.vacationDaysPerYear ;
this.vacationDays this.vacationDaysPerYear;
public String getDepartment
return "Department: department;
public void setDepartmentString department
this.department department;
c
public class Employee extends Person
private int employeeId;
private double salary;
private String department;
public EmployeeString firstName,String lastName,String jobTitle,double sal,int empId,String department
superfirstNamelastName,jobTitle;
this.employeeId empId;
this.salary sal;
this.vacationDaysPerYear ;
this.vacationDays this.vacationDaysPerYear;
this.department department;
public String getDepartment
return "Department: department;
public void setDepartmentString department
this.department department;
d
public class Employee extends Person
private int employeeId;
private double salary;
private String department;
public EmployeeString firstName,String lastName,String jobTitle,double sal,int empId,String department
superfirstNamelastName,jobTitle;
this.employeeId empId;
this.salary sal;
this.vacationDaysPerYear ;
this.vacationDays this.vacationDaysPerYear;
empdepartment department;
public String getDepartment
return "Department: department;
public void setDepartmentString department
empdepartment department;
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