This Looks Like a Job For


#1



https://www.codecademy.com/en/courses/python-intermediate-en-WL8e4/2/4?curriculum_id=4f89dab3d788890003000096#


Traceback (most recent call last):
File "python", line 19, in
File "python", line 16, in full_time_wage
AttributeError: 'super' object has no attribute 'full_time_wage'


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(self, hours):
        self.hours=hours
        return hours*12
    def full_time_wage(self, hours):
        return super(Employee, self).full_time_wage(hours)
        
milton=PartTimeEmployee("milton")
print milton.full_time_wage(10)


#2

here:

return super(Employee, self).full_time_wage(hours)

the first argument of super should be Derived class (PartTimeEmployee)


#3

Traceback (most recent call last):
File "python", line 19, in
File "python", line 16, in full_time_wage
AttributeError: 'super' object has no attribute 'full_time_wage'

class PartTimeEmployee(Employee):
    def calculate_wage(self, hours):
        self.hours=hours
        return hours*12
    def full_time_wage(self, hours):
        return super(PartTimeEmployee, self).full_time_wage(hours)
        
milton=PartTimeEmployee("milton")
print milton.full_time_wage(10)

#4

super() allows you to call methods of parent class, full_time_wage is not the method of Employee class you want to call


#5

i chaged full_time_wage to calculate_wage

Traceback (most recent call last):
File "python", line 19, in
File "python", line 16, in full_time_wage
AttributeError: 'super' object has no attribute 'calcualte_wage'


#6

spelling calculate correctly would help

If you need more help, post an updated version of your full code


#8

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