
# person.py


import datetime

class Person():

    def __init__(self, name):
        self.name = name
        self.birthday = None

    def __str__(self):
        return self.name + ": " + str(self.birthday)

    def getName(self):
        return self.name

    def setBirthday(self, day, month, year):
        self.birthday = datetime.date(year, month, day)

    def getAge(self):
        # returns self's current age in days
        if self.birthday == None:
            print("No birthday information")
            return 0
        else:
            return (datetime.date.today() - self.birthday).days




# test code
me = Person("Andrew Davison")
print(me)
print("My name:", me.getName())
me.setBirthday(23, 7, 1962)
print(me)

tom = Person("Tom Cruise")
tom.setBirthday(3, 7, 1962)
print(tom)

people = [me, tom]
for p in people:
    print(" ", p, "; today:", p.getAge())
