-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass_1.py
More file actions
73 lines (54 loc) · 1.39 KB
/
Copy pathClass_1.py
File metadata and controls
73 lines (54 loc) · 1.39 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
65
66
67
68
69
70
71
72
73
class Employee:
raise_amount=1.10
def __init__(self , first , last , pay):
self.first=first
self.last=last
self.pay= pay
self.email=first + '.' + last +"@ashok.com"
def fullname(self):
return '{}{}'.format(self.first,self.last)
def x_raise(self):
self.pay = int(self.pay *self.raise_amount)
@classmethod
def set_raiseamt(cls , amount):
cls.raise_amount = amount
@classmethod
def from_string(cls,emp_str):
first, last, pay = emp_str1.split('-')
return cls(first, last, pay)
emp1 = Employee('varun', 'saagar',60000)
emp2 = Employee('prasanth' , ' venkat' , 60000)
emp3 = Employee('ruthra','pathy' , 60000)
Employee.set_raiseamt(1.05)
Employee.raise_amount = 1.10
print(Employee.raise_amount)
print(emp1.raise_amount)
print(emp2.raise_amount)
# emp1.x_raise()
# print(emp1.pay)
# # print(emp1.pay)
# emp2.raise_amount=1.15
#
# emp2.x_raise()
#
# print(emp2.pay)
#
# emp3.x_raise()
# print(emp3.pay)
#
# print(Employee.x_raise)
emp_str1= 'Varun-Saagar-70000'
emp_str2='Prasanth-Venakt-30000'
emp_str3='Rthra-Pathy-400000'
first,last,pay = emp_str1.split('-')
newemp1 = Employee(first,last,pay)
#
# print(newemp1.email)
# print(newemp1.pay)
# emp1.fullname()
# print(Employee.fullname(emp1))
# print(emp1)
# print(emp1)
# print(emp1.email )
# print(emp2.email )
# print('{}{}'.format(emp1.first,emp1.last))