-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemployeeclass.py
More file actions
64 lines (44 loc) · 1.17 KB
/
employeeclass.py
File metadata and controls
64 lines (44 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
class Employee:
mount_of_raise=1.04
no_of_emps=0
def __init__(self,first,last,pay):
self.first=first
self.last=last
self.pay=pay
self.email="{}.{}@company.com".format(self.first,self.last)
Employee.no_of_emps+=1
def fullname(self):
return "{} {}".format(self.first,self.last)
def apply_pay(self):
self.pay=int(self.pay * self.mount_of_raise)
@classmethod
def set_raise_mount(cls,amount):
cls.mount_of_raise=amount
@classmethod
def from_string(cls,emp_string):
first,last,pay=emp_string.split('-')
return Employee(first,last,pay)
@staticmethod
def is_workday(day):
if day.weekday() == 5 or day.weekday() ==6:
return False
return True
print(Employee.no_of_emps)
emp_1=Employee('Dan','Xie',50000)
emp_2=Employee('Tony','Chen',60000)
##print(emp_1.email)
#print(emp_1.fullname())
#print(emp_1.__dict__)
#print(Employee.__dict__)
#Employee.set_raise_mount(1.05)
#print(emp_1.pay)
#emp_1.apply_pay()
#print(emp_1.pay)
#print(Employee.no_of_emps)
#emp_str_1='Pit-Hat-70000'
#new_emp_1=Employee.from_string(emp_str_1)
#print(new_emp_1.fullname())
import datetime
TD=datetime.date(2017,3,20)
print(Employee.is_workday(TD))