#here is the code
class Employee:
noofemps = 0
raiseamount = 1.05
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + '.' + last + '@email.com'
Employee.noofemps += 1
def fullname(self):
return '{} {}'.format(self.first.title(), self.last.title())
def applyraise(self):
self.pay = int(self.pay * self.raiseamount)
emp1 = Employee('rahul', 'sharma', 30000)
emp2 = Employee('dev', 'verma', 40000)
你可能喜欢这个。我删除电子邮件的简短
然后就这样出来了
通过这种方式,您可以看到,当您设置raiseamount时,不仅加薪金额发生了变化,而且应用加薪也完成了
相关问题 更多 >
编程相关推荐