Advertisement
skotoseme

classy.py

Oct 15th, 2016
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. print('---------------------------------------------------------------------')
  2.  
  3. class Employee:
  4.    
  5.     num_of_emps = 0
  6.     raise_amount = 1.04
  7.    
  8.     def __init__(self, first, last, pay):
  9.         self.first = first
  10.         self.last = last
  11.         self.pay = pay
  12.         self.email = '{}.{}@company.com'.format(first, last)
  13.        
  14.         Employee.num_of_emps += 1
  15.    
  16.     def fullname(self):
  17.         return '{} {}'.format(self.first, self.last)
  18.    
  19.     def apply_raise(self):
  20.         self.pay = int(self.pay * self.raise_amount)
  21.  
  22. emp_1 = Employee('Corey', 'Schafer', 50000)
  23. emp_2 = Employee('Test', 'User', 60000)
  24.  
  25. print(Employee.raise_amount)
  26. print(emp_1.raise_amount)
  27. print(emp_2.raise_amount)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement