Quotes help make search much faster. Example: "Practice Makes Perfect"

Sunday, December 2, 2012

Codecademy: Override!


#sample solution


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 __init__(self, employee_name):
self.employee_name = employee_name

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

#Test
Employee1 = Employee("Jim")
print Employee1.employee_name + "'s wage is " + str(Employee1.calculate_wage(80))
Employee2 = PartTimeEmployee("Pam")
print Employee2.employee_name + "'s wage is " + str(Employee2.calculate_wage(80))

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts