Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the subclass Contractor of the base class Person example provided in the tutorial, what if we need to keep track of the project for

For the subclass Contractor of the base class Person example provided in the tutorial, what if we need to keep track of the project for each contractor? What code segment could be used to properly initialize, and add methods to set and get this value?
a.)
class Contractor(Person):
def __init__(self,fname,lname,title,wage,contractorid):
super().__init__(fname,lname,title)
self.contractorid = contractorid
self.hourlywage = wage
self.project = project
def get_project(self):
return self.project
def set_project(self, project):
self.project = project
b.)
class Contractor(Person):
def __init__(self,fname,lname,title,wage,contractorid,project):
super().__init__(fname,lname,title)
self.contractorid = contractorid
self.hourlywage = wage
self.project = project
def get_project(self):
return self.project
def set_project(self, project):
self.project = project
c.)
class Contractor(Person):
def __init__(self,fname,lname,title,wage,contractorid,project):
self.contractorid = contractorid
self.hourlywage = wage
self.project = project
def get_project(self):
return self.project
def set_project(self, project):
self.project = project
d.)
class Contractor(Person):
def __init__(self,fname,lname,title,wage,contractorid,project):
super().__init__(fname,lname,title)
self.contractorid = contractorid
self.hourlywage = wage
self.project = project
def get_project(self):
return project
def set_project(self, project):
self.project = project

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

More Books

Students also viewed these Databases questions

Question

10. Describe the relationship between communication and power.

Answered: 1 week ago