""" A module with a simple Worker class. Class demonstrates attributes and an initializer. Author: Walker M. White (wmw2), Steve Marschner (srm2) Date: October 1, 2017 (Python 3 Version) """ class Worker(object): """ A class to represent a worker in a certain organization INSTANCE ATTRIBUTES: lname: Last name. [str] ssn: Social security no. [int in 0..999999999] boss: The worker's boss. [Worker, or None if no boss] """ def __init__(self, lname, ssn, boss): """ Initializer: Creates an instance with last name n, soc sec number s, and boss b. Parameter lname: The worker's last name Precondition: lname is a string Parameter ssn: The worker's social security number Precondition: ssn is an int in 0..999999999 Parameter boss: The worker's boss Precondition: boss is another Worker object or None """ self.lname = lname self.ssn = ssn self.boss = boss def __str__(self): """ Returns: text representation of this Worker """ return ('Worker ' + self.lname + '. Soc sec XXX-XX-' + str(self.ssn % 10000) + ('.' if self.boss is None else '. boss: ' + self.boss.lname))