14/18 help


I need help. I have no clue what I am doing wrong.
Here is my code:
1. class Employee(object):
2. """Models real-life employees!"""
3. def init(self, employee_name):
4. self.employee_name = employee_name
6. def calculate_wage(self, hours):
7. self.hours = hours
8. return hours * 20.00
10. # Add your code below!
11. class PartTimeEmployee(Employee):
12. def init(self, hours):
13. self.hours = hours
14. return hours * 12.00
15. print hours * 12.00
16. def full_time_wage(self, hours):
17. return super(PartTimeEmployee, self).calculate_wage(hours)
19. milton = PartTimeEmployee("John")
20. print milton.full_time_wage(10)

it throws this error:
Your code raised an exception, have a look at the console window for the error message!

and the console window reads:
Traceback (most recent call last):
File "python", line 19, in
File "python", line 14, in init
TypeError: can't multiply sequence by non-int of type 'float'


I have put in the line numbers to help with the error message from the console window


can you re-post your code without the line numbers. to format it with indents select it after you paste here and press ctrl+k

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, hours):
        self.hours = hours
        return hours * 12.00
        print hours * 12.00
    def full_time_wage(self, hours):
        return super(PartTimeEmployee, self).calculate_wage(hours)

milton = PartTimeEmployee("John")
print milton.full_time_wage(10)


I got it. I figured out where I had made a mistake.


Would you mind explaining?


The problem mhudson32 solved was:

In creating the class PartTimeEmployee, he is initializing twice. Since Employee is its object, we can skip this step and go straight to defining calculate_wage.
The body of his init is actually the body of the calculate_wage method.