Question: For the base class Person example provided in the Unit 3 Revisiting the Employee Class Program tutorial, if we need to add a subclass for

For the base class Person example provided in the Unit 3 Revisiting the Employee Class Program tutorial, if we need to add a subclass for Volunteers who have a host employee and are assigned to a project, what code segment could implement this subclass and create an instance of it called volunteer_1?
class Volunteer:
def __init__(self,fname,lname,title,host,project):
super().__init__(fname,lname,title)
self.host = host
self.project = project
def get_host(self):
return "Host: "+ str(self.host)
def set_host(self,newhost):
self.host = newhost
def get_project(self):
return "Project: "+ str(self.project)
def set_project(self, project):
self.project = project
volunteer_1= Volunteer('John','Doe','Volunteer','Jane Doe','Project_X')
class Volunteer:
def __init__(self,fname,lname,title,host,project):
super().__init__(fname,lname,title,project)
self.host = host
self.project = project
def get_host(self):
return "Host: "+ str(host)
def set_host(self,newhost):
self.host = newhost
def get_project(self):
return "Project: "+ str(project)
def set_project(self, project):
self.project = project
volunteer_1= Volunteer('John','Doe','Volunteer','Jane Doe','Project_X')
class Volunteer(Person):
def __init__(self,fname,lname,title,host,project):
super().__init__(fname,lname,title, project)
self.host = host
self.project = project
def get_host(self):
return "Host: "+ str(self.host)
def set_host(self,newhost):
self.host = newhost
def get_project(self):
return "Project: "+ str(self.project)
def set_project(self, project):
self.project = project
volunteer_1= Volunteer('John','Doe','Volunteer','Jane Doe','Project_X')
class Volunteer(Person):
def __init__(self,fname,lname,title,host,project):
super().__init__(fname,lname,title)
self.host = host
self.project = project
def get_host(self):
return "Host: "+ str(self.host)
def set_host(self,newhost):
self.host = newhost
def get_project(self):
return "Project: "+ str(self.project)
def set_project(self, project):
self.project = project
volunteer_1= Volunteer('John','Doe','Volunteer','Jane Doe','Project_X')

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!