#!/usr/bin/env python3 

#page 44

from person import Person

class Manager(Person):
    def __init__(self, name, age, pay):
        Person.__init__(self, name, age, pay, 'manager')
    def giveRaise(self, percent, bonus=0.5):
        self.pay *= (1.0 + percent + bonus)


if __name__ == '__main__':
    asher = Manager('chengshuang li', 34, 40000)
    print(asher.name)
    print(asher.lastName())
    print(asher.pay)
    asher.giveRaise(.50)
    print(asher.name)
    print(asher.pay)

    

    bob = Person('Bob Smith', 42, 30000, 'software')
    sue = Person('Sue Jones', 45, 45000, 'hardware')
    kouer= Person('wenli kou ', 20, 50000, 'saler')
#    asher= Manager('chengshuang li', 34, 60000, 'engineer')

    db = [ bob, sue, kouer, asher]

    for obj in  db:
        print(obj.name, obj.pay)
        obj.giveRaise(0.2)
        print(obj.name, obj.pay)

    for obj in  db:
        print(obj.lastName(), '=>', obj.pay)

    print(kouer)
    print(asher)
    print("__" * 30)
    for obj in db:
        print(obj)
        for key in obj.__dict__:
            print(key, '=>', getattr(obj,key))
        print()
