How do I print my new employee’s full_time_wage results?

Question

How do I print my new employee’s full_time_wage results?

Answer

If you’ve created the new full_time_wage() method in your PartTimeEmployee class, then you’ll need to create your milton object. milton is a PartTimeEmployee object, so you’ll create it like this:
milton = PartTimeEmployee(“name_here”)
And then we use the methods available in the PartTimeEmployee class by attaching them to our milton object, like this:
milton.method_name(“parameters”)
Don’t forget to pass it a value surrounded by parentheses!

3 Likes

How should i write the full_time_wage() function?

1 Like

You use this format:

class Derived(Base):
def m(self):
return super(Derived, self).m()

1 Like

The problem I have is that to get the code to run the two "m"s are different. It might help if this is clarified.

2 Likes

How can I print miltons name at the bottom?

class Employee(object):

def init(self, employee_name):

self.employee_name = employee_name

def calculate_wage(self, hours):

self.hours = hours

return hours * 20.00

def medicare_tax(self, hours):

self.hours = hours

return (hours) *.10

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 = Employee(“Milton Bradford”)

print milton.medicare_tax(10)

print milton.calculate_wage(10)

print milton.employee_name

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.00
  def full_time_wage(self, hours):
    return super(PartTimeEmployee, self).calculate_wage(self, hours)
milton = PartTimeEmployee('Milton', 10)
print milton.full_time_wage()

why its not working

Did you manage to get this to work, it is the same for me and it is not working.

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.00
  def full_time_wage(self, hours):
    return super(PartTimeEmployee, self).calculate_wage(hours)
milton = PartTimeEmployee('Milton')
print milton.full_time_wage(10)
return super(PartTimeEmployee, self).calculate_wage(self, hours) <- hours as argument

milton = PartTimeEmployee(‘Milton’, 10) ← takes string only
print milton.full_time_wage() ← takes 10 as argument