This Looks Like a Job For... 14


Traceback (most recent call last):
File "python", line 20, in
TypeError: full_time_wage() takes exactly 1 argument (2 given)

It should print 200.00

class Employee(object):
    """Models real-life employees!"""
    def __init__(self, employee_name):
        self.employee_name = employee_name

    def calculate_wage(self, hours):
        self.hours = hours
        return hours * 20.00

# Add your code below!
class PartTimeEmployee(Employee):
    def calculate_wage(hours):
        self.hours = hours
        return hours * 12.00
    def full_time_wage(hours):
        return super(PartTimeEmployee).calculate_wage()
milton = PartTimeEmployee('milton')
print milton.full_time_wage(10)


Might you need to include hours in the method call?


Can I ask,

why does the super method only need hours? not (self, hours) like the usual?


It actually does need self to be passed in.

class PartTimeEmployee(Employee):
    def calculate_wage(self,hours):
	self.hours = hours
	return hours * 12.00
    def full_time_wage(self, hours):
	return super(PartTimeEmployee, self).calculate_wage(hours)


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.