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 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

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

Beginning VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions