Question: Need help with python code following: Making the Employee class an abstract class Adding a ShiftSupervisor subclass of employee with an accessor and mutator method
Need help with python code following:
Making the Employee class an abstract class
Adding a ShiftSupervisor subclass of employee with an accessor and mutator
method for each of the two added subclass attributes, annual salary and
annual production bonus that a shift supervisor has earned. Naming the
accessor method getbonus for the annual production bonus.
My code part
class Employee:
def setnameself name:
self.name name
def setidnumberself idnumber:
self.idnumber idnumber
def getnameself:
return self.name
def getidnumberself:
return self.idnumber
class ProductionWorkerEmployee:
def setshiftnumberself shiftnumber:
self.shiftnumber shiftnumber
def setpayrateself payrate:
self.payrate payrate
def getshiftnumberself:
return self.shiftnumber
def getpayrateself:
return self.payrate
class ShiftSupervisorEmployee:
def setannualsalaryself annualsalary:
self.annualsalary annualsalary
def setannualbonusself annualbonus:
self.annualbonus annualbonus
def getannualsalaryself:
return self.annualsalary
def getannualbonusself:
return self.annualbonus
My code part two:
from employee import
def main:
workername inputEnter the name:
workerid inputEnter the ID number:
workershift intinputEnter the shift number:
workerpay floatinputEnter the hourly pay rate:
# Create an instance of ProductionWorker
worker ProductionWorker
worker.setnameworkername
worker.setidnumberworkerid
worker.setshiftnumberworkershift
worker.setpayrateworkerpay
# Display worker information
printProduction worker information:
printfName: workergetname
printfID number: workergetidnumber
printfShift: workergetshiftnumber
printfHourly Pay Rate: $workergetpayrate:f
# You can add similar code for ShiftSupervisor here after instantiating it
def showworkerworker:
printfName: workergetname
printfID Number: workergetidnumber
if isinstanceworker ProductionWorker:
printfShift Number: workergetshiftnumber
printfHourly Pay Rate: $workergetpayrate:f
elif isinstanceworker ShiftSupervisor:
printfAnnual Salary: $workergetannualsalary:f
printfAnnual Production Bonus: $workergetannualbonus:f
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
