Question: For the subclass Employee of the base class Person example provided in the tutorial, what if we need to keep track of the department for
For the subclass Employee of the base class Person example provided in the tutorial, what if we 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
class EmployeePerson:
def initselffname,lnametitle,sal,empid,department:
superinitfnamelnametitle
self.employeeid empid
self.salary sal
self.vacationdaysperyear
self.vacationdays self.vacationdaysperyear
empdepartment department
def getdepartmentself:
return "Department: strselfdepartment
b
class EmployeePerson:
def initselffname,lnametitle,sal,empid,department:
superinitfnamelnametitle, department
self.employeeid empid
self.salary sal
self.vacationdaysperyear
self.vacationdays self.vacationdaysperyear
self.department department
def getdepartmentself:
return "Department: strselfdepartment
c
class EmployeePerson:
def initselffname,lnametitle,sal,empid,department:
superinitfnamelnametitle
self.employeeid empid
self.salary sal
self.vacationdaysperyear
self.vacationdays self.vacationdaysperyear
self.department department
def getdepartment:
return "Department: strselfdepartment
d
class EmployeePerson:
def initselffname,lnametitle,sal,empid,department:
superinitfnamelnametitle
self.employeeid empid
self.salary sal
self.vacationdaysperyear
self.vacationdays self.vacationdaysperyear
self.department department
def getdepartmentself:
return "Department: strselfdepartment
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
