Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

Make efficient use of your practice time?

Answered: 1 week ago