#取姓氏和涨工资未封装
class Person():
def __init__(self,name,job=None,pay=0):
self.name = name
self.job = job
self.pay = pay
if __name__ == '__main__':
bob = Person('bob smith')
sue = Person('sue jones',job='dev',pay=100000)
print(bob.name,bob.pay)
print(sue.name,sue.pay)
print(bob.name.split()[-1])
sue.pay *=1.10
print(sue.pay)
#print(bob.lastname())
'''
#将取姓氏和涨工资封装
class Person():
def __init__(self,name,job=None,pay=0):
self.name = name
self.job = job
self.pay = pay
def lastName(self):
return(self.name.split()[-1])
def giveRaise(self,percent):
self.pay = int(self.pay * (1+percent))
if __name__ == '__main__':
bob = Person('bob smith')
sue = Person('sue jones',job='dev',pay=100000)
print(bob.name,bob.pay)
print(sue.name,sue.pay)
print(bob.lastName(),sue.lastName())
sue.giveRaise(.10)
print(sue.pay)
print(sue)