14/18 What is wrong in my code?


#1



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


#2

Please post a link to the exercise. Thanks.


#3

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


#4

Is there some number of hours that you need to pass?


#5

No, its not given in the exercise.


#6

If that line is needed, then invent some number of hours, say, 20. The hours variable is undefined in that scope.

You should see his wage printed out at $20.00 per hour! (That is, for 10 hours, the result should be 200.00.)


#7

What should I put there instead of 'hours', because it checks for many cases.


#8

Use any number.

print milton.full_time_wage(10)

#9

But then it says,your code fails for milton.full_time_wage(0)


#10

I got it, Thanks for help


#11

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