Created
February 2, 2018 00:40
-
-
Save AumCoin/d317a2a63db299ace168f3878efe25d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee(): | |
def __init__(self,first,last,ssn,sal): | |
self.first = first | |
self.last = last | |
self.ssn = ssn | |
self.sal = sal | |
def __str__(self): | |
outstring = '{0}, {1} - ${2} - {3}'.format(self.last,self.first,self.sal,self.ssn) | |
return outstring | |
def giveRaise(self,percentRaise): | |
self.sal += int(self.sal * (percentRaise / 100)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Manager(Employee): | |
def __init__(self,first,last,ssn,sal,title,bonus): | |
self.title = title | |
self.bonus = bonus | |
self.first = first | |
self.last = last | |
self.ssn = ssn | |
self.sal = sal | |
def __str__(self): | |
outstring = '{0}, {1} - {4} - ${2}/{5} - {3}'.format(self.last,self.first,self.sal,self.ssn,self.title,self.bonus) | |
return outstring |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from employee import Employee | |
from manager import Manager | |
employees = [] | |
employees.append(Employee("Miller","Steven",111111111,30000)) | |
employees.append(Employee("Carlson","Mark",222222222,40000)) | |
employees.append(Employee("Smith","John",333333333,50000)) | |
employees.append(Manager("Jordan", "Ambrose", 444444444, 60000, "Assistant Manager", 20000)) | |
employees.append(Manager("Menkveld", "Bob", 555555555, 70000, "General Manager", 30000)) | |
for emp in employees: | |
print(emp) | |
emp.giveRaise(10) | |
print(emp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment