Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Employe:
- no_of_emp = 0
- raise_amount = 2.5
- def __init__(self, fname, lname, pay):
- self.first = fname
- self.last = lname
- self.pay = pay
- Employe.no_of_emp += 1
- def name(self):
- self.mail = self.first + '@gmail.com'
- # return ('{} {}'.format(self.first, self.last))
- return ('{}'.format(self.mail))
- def apply(self):
- self.pay = self.pay * self.raise_amount
- @classmethod # is used to set value through obj
- def chng_raise_amnt(cls, amount):
- cls.raise_amount = amount
- @classmethod
- def form_str(cls, emp_str):
- fn, ln, amn = emp_str.split('-')
- return cls(fn,ln,amn)
- emp_1 = Employe('riju', 'chowdhury', '3000')
- # emp_1.apply()
- # emp_1.pay
- emp_str_1 = 'samrat-mitra-6000'
- new_emp_1 = Employe.form_str(emp_str_1)
- print(new_emp_1.name())
- # emp_1.chng_raise_amnt(3.09)
- # print(Employe.raise_amount)
- # print(emp_1.raise_amount)
- # print(emp_1.raise_amount)
Advertisement
Add Comment
Please, Sign In to add comment