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 Visitors who have a host employee and are visiting a specific building, what code segment could implement this subclass and create an instance of it called visitor_1?
class Visitor:
def __init__(self,fname,lname,title,host,area_visiting):
super().__init__(fname,lname,title,host,area_visiting)
self.host = host
self.area_visiting = area_visiting
def get_host(self):
return "Host: "+ str(host)
def set_host(self,newhost):
self.host = newhost
def get_area(self):
return "Area Visiting: "+ str(area_visiting)
def set_area(self, area_visiting):
self.project = area_visiting
visitor_1= Visitor('John','Doe','Visitor','Jane Doe','Main Building')
class Visitor(Person):
def __init__(self,fname,lname,title):
super().__init__(fname,lname,title,host,area_visiting)
self.host = host
self.area_visiting = area_visiting
def get_host(self):
return "Host: "+ str(self.host)
def set_host(self,newhost):
self.host = newhost
def get_area(self):
return "Area Visiting: "+ str(self.area_visiting)
def set_area(self, area_visiting):
self.project = area_visiting
visitor_1= Visitor('John','Doe','Visitor','Jane Doe','Main Building')
class Visitor:
def __init__(self,fname,lname,title,host,area_visiting):
super().__init__(fname,lname,title)
self.host = host
self.area_visiting = area_visiting
def get_host(self):
return "Host: "+ str(self.host)
def set_host(self,newhost):
self.host = newhost
def get_area(self):
return "Area Visiting: "+ str(self.area_visiting)
def set_area(self, area_visiting):
self.project = area_visiting
visitor_1= Visitor('John','Doe','Visitor','Jane Doe','Main Building')
class Visitor(Person):
def __init__(self,fname,lname,title,host,area_visiting):
super().__init__(fname,lname,title)
self.host = host
self.area_visiting = area_visiting
def get_host(self):
return "Host: "+ str(self.host)
def set_host(self,newhost):
self.host = newhost
def get_area(self):
return "Area Visiting: "+ str(self.area_visiting)
def set_area(self, area_visiting):
self.project = area_visiting
visitor_1= Visitor('John','Doe','Visitor','Jane Doe','Main Building')
SAVE & CONTINUE

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!