Answer to Question #195547 in Python for desmond

Question #195547

3.Write an Employee class that keeps data attributes for the following pieces of information:

a. Employee name

b. Employee number Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information:

c. Shift number (an integer, such as1 for morning shift, 2 for evening shift)

d. Hourly pay rate Write the appropriate accessor and mutator methods for each class.


1
Expert's answer
2021-05-21T16:49:53-0400
class Employee:
    def __init__(self,name,number):
        self.name=name
        self.number=number
        
    def setName(self,n):
        self.name=n
        
    def getName(self):
        return self.name
    
    def setNumber(self,num):
        self.number=num
        
    def getNumber(self):
        return self.number


class ProductionWorker(Employee):
    def __init__(self,shift_num,hourly_pay_rate):
        self.shift_num=shift_num
        self.hourly_pay_rate=hourly_pay_rate
        
    def getShiftNum(self,snum):
        self.shift_num=snum
        
    def getShiftNum(self):
        return self.shift_num
        
    def setHrPayRate(self,h):
        self.hourly_pay_rate=h
        
    def getHrPayRate(self):
        return hourly_pay_rate
    

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS