class Employee: """Employee class with Date attributes""" def __init__(self, firstName, lastName, birthMonth, birthDay, birthYear, hireMonth, hireDay, hireYear): """Constructor for class Employee""" self.birthDate = Date(birthMonth, birthDay, birthYear) self.hireDate = Date(hireMonth, hireDay, hireYear) self.lastName = lastName self.firstName = firstName print "Employee constructor: %s, %s" \ % ( self.lastName, self.firstName ) def __del__(self): """Called before Employee destruction""" print "Employee object about to be destroyed: %s, %s" \ % ( self.lastName, self.firstName ) def display(self): """Prints employee information""" print "%s, %s" % (self.lastName, self.firstName) print "Hired:", self.hireDate.display() print "Birth date:", self.birthDate.display()
class Employee: """Employee class with Date attributes""" def __init__( self, firstName, lastName, birthMonth, birthDay, birthYear, hireMonth, hireDay, hireYear ): """Constructor for class Employee""" self.birthDate = Date( birthMonth, birthDay, birthYear ) self.hireDate = Date( hireMonth, hireDay, hireYear ) self.lastName = lastName self.firstName = firstName print "Employee constructor: %s, %s" \ % ( self.lastName, self.firstName ) def __del__( self ): """Called before Employee destruction""" print "Employee object about to be destroyed: %s, %s" \ % ( self.lastName, self.firstName ) def display( self ): """Prints employee information""" print "%s, %s" % ( self.lastName, self.firstName ) print "Hired:", self.hireDate.display() print "Birth date:", self.birthDate.display()
class Employee(): """Documentation for Employee """ def __init__(self, firstName, lastName, birthMonth, birthDay, birthYear, hireMonth, hireDay, hireYear): self.birthDate = Date(birthMonth, birthDay, birthYear) self.hireDate = Date(hireMonth, hireDay, hireYear) self.lastName = lastName self.firstName = firstName print("Employee construction: %s, %s" % (self.lastName, self.firstName)) def __del__(self): print("Employee object about to be destroyed: %s, %s" % (self.lastName, self.firstName)) def display(self): print ("%s, %s\nHired:%s\nBirth Date:%s\n" % (self.lastName, self.firstName, self.hireDate.display(), self.birthDate.display()))
from Date import Date a = Date(4, 7, 1999) b = Date(5, 6, 2000) c = Date(12, 2, 2014) a.display() b.display() c.display()