Answered step by step
Verified Expert Solution
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 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
class Visitor:
def initselffname,lnametitle,host,areavisiting:
superinitfnamelnametitle,host,areavisiting
self.host host
self.areavisiting areavisiting
def gethostself:
return "Host: strhost
def sethostselfnewhost:
self.host newhost
def getareaself:
return "Area Visiting: strareavisiting
def setareaself areavisiting:
self.project areavisiting
visitor VisitorJohn'Doe','Visitor','Jane Doe','Main Building'
class VisitorPerson:
def initselffname,lnametitle:
superinitfnamelnametitle,host,areavisiting
self.host host
self.areavisiting areavisiting
def gethostself:
return "Host: strselfhost
def sethostselfnewhost:
self.host newhost
def getareaself:
return "Area Visiting: strselfareavisiting
def setareaself areavisiting:
self.project areavisiting
visitor VisitorJohn'Doe','Visitor','Jane Doe','Main Building'
class Visitor:
def initselffname,lnametitle,host,areavisiting:
superinitfnamelnametitle
self.host host
self.areavisiting areavisiting
def gethostself:
return "Host: strselfhost
def sethostselfnewhost:
self.host newhost
def getareaself:
return "Area Visiting: strselfareavisiting
def setareaself areavisiting:
self.project areavisiting
visitor VisitorJohn'Doe','Visitor','Jane Doe','Main Building'
class VisitorPerson:
def initselffname,lnametitle,host,areavisiting:
superinitfnamelnametitle
self.host host
self.areavisiting areavisiting
def gethostself:
return "Host: strselfhost
def sethostselfnewhost:
self.host newhost
def getareaself:
return "Area Visiting: strselfareavisiting
def setareaself areavisiting:
self.project areavisiting
visitor VisitorJohn'Doe','Visitor','Jane Doe','Main Building'
SAVE & CONTINUE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started