Override!


#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

Add your code below!

class PartTimeEmployee(Employee):
def calculated_wage(self, hours):
self.hours=hours
return hours * 12.00

VC=PartTimeEmployee("saket")
AC=Employee("Navi")
VC.calculated_wage(AC)

what's wrong in my code?

Getting error:
Oops, try again. Did you remember to pass self as an argument to your calculate_wage method?


#2

@saketvicky,
From
http://stackoverflow.com/questions/15081542/python-creating-objects
http://stackoverflow.com/questions/1535327/how-to-print-a-class-or-objects-of-class-using-print

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 calculated_wage(self,hours):
        # self.hours=hours
        return hours * 12.00

VC=PartTimeEmployee("saket")
AC=Employee("Navi")

print VC.calculated_wage(2)

#3

Getting this error now:

Oops, try again. It looks like your PartTimeEmployee's calculate_wage method doesn't override Employee's calculate_wage method.


#4

@saketvicky,

Then have a close look at your Method-name.....

PartTimeEmployee's calculate_wage


#5

Thank you so much :slight_smile: