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 Employee(Person):
def __init__(self,fname,lname,title,sal,empid,department):
super().__init__(fname,lname,title)
self.employeeid = empid
self.salary = sal
self.vacationdaysperyear =14
self.vacationdays = self.vacationdaysperyear
emp_department = department
def get_department(self):
return "Department: "+ str(self.department)
b.)
class Employee(Person):
def __init__(self,fname,lname,title,sal,empid,department):
super().__init__(fname,lname,title, department)
self.employeeid = empid
self.salary = sal
self.vacationdaysperyear =14
self.vacationdays = self.vacationdaysperyear
self.department = department
def get_department(self):
return "Department: "+ str(self.department)
c.)
class Employee(Person):
def __init__(self,fname,lname,title,sal,empid,department):
super().__init__(fname,lname,title)
self.employeeid = empid
self.salary = sal
self.vacationdaysperyear =14
self.vacationdays = self.vacationdaysperyear
self.department = department
def get_department():
return "Department: "+ str(self.department)
d.)
class Employee(Person):
def __init__(self,fname,lname,title,sal,empid,department):
super().__init__(fname,lname,title)
self.employeeid = empid
self.salary = sal
self.vacationdaysperyear =14
self.vacationdays = self.vacationdaysperyear
self.department = department
def get_department(self):
return "Department: "+ str(self.department)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!