@@ -18,34 +18,44 @@ def fullname(self):
18
18
def apply_raise (self ):
19
19
self .pay = int (self .pay * self .raise_amt )
20
20
21
- emp_1 = Employee ('Corey' , 'Schafer' , 50000 )
22
- emp_2 = Employee ('Test' , 'Employee' , 60000 )
23
-
24
- print (Employee .raise_amt )
25
- print (emp_1 .raise_amt )
26
- print (emp_2 .raise_amt )
27
-
21
+ @classmethod
22
+ def set_raise_amt (cls , amount ):
23
+ cls .raise_amt = amount
28
24
25
+ @classmethod
26
+ def from_string (cls , emp_str ):
27
+ first , last , pay = emp_str .split ('-' )
28
+ return cls (first , last , pay )
29
29
30
+ @staticmethod
31
+ def is_workday (day ):
32
+ if day .weekday () == 5 or day .weekday () == 6 :
33
+ return False
34
+ return True
30
35
31
36
32
- # emp_str_1 = 'John-Doe-70000'
33
- # emp_str_2 = 'Steve-Smith-30000'
34
- # emp_str_3 = 'Jane-Doe-90000'
35
-
36
- # first, last, pay = emp_str_1.split('-')
37
+ emp_1 = Employee ('Corey' , 'Schafer' , 50000 )
38
+ emp_2 = Employee ('Test' , 'Employee' , 60000 )
37
39
38
- # new_emp_1 = Employee(first, last, pay)
39
- # new_emp_1 = Employee.from_string(emp_str_1)
40
+ Employee .set_raise_amt (1.05 )
40
41
41
- # print(new_emp_1.email)
42
- # print(new_emp_1.pay)
42
+ print (Employee .raise_amt )
43
+ print (emp_1 .raise_amt )
44
+ print (emp_2 .raise_amt )
43
45
46
+ emp_str_1 = 'John-Doe-70000'
47
+ emp_str_2 = 'Steve-Smith-30000'
48
+ emp_str_3 = 'Jane-Doe-90000'
44
49
50
+ first , last , pay = emp_str_1 .split ('-' )
45
51
52
+ #new_emp_1 = Employee(first, last, pay)
53
+ new_emp_1 = Employee .from_string (emp_str_1 )
46
54
55
+ print (new_emp_1 .email )
56
+ print (new_emp_1 .pay )
47
57
48
- # import datetime
49
- # my_date = datetime.date(2016, 7, 10 )
58
+ import datetime
59
+ my_date = datetime .date (2016 , 7 , 11 )
50
60
51
- # print(Employee.is_workday(my_date))
61
+ print (Employee .is_workday (my_date ))
0 commit comments