Please send questions to st10@humboldt.edu .
"""
Module lect13_8
Superclass Employee and Subclass Chef
    modified from "Learning Python", Lutz and Ascher, O'Reilly
    p. 347, I think, but example is referred to in Chapters 19-23

adapted by: Sharon M. Tuttle
last modified: 11-19-05
"""

class Employee:
    """
    Yup, this is the docstring for a class!
    Class Employee: a worker
    """
    def __init__(self, lastname, salary=0):
        """
        Employee constructor
        """
        self.lastname = lastname
        self.salary = salary

    def giveRaise(self, percent):
        """
        Increase this employee's salary by <percent>
        """
        self.salary = self.salary + (self.salary * percent)

    def work(self):
        """
        print a message saying what this Employee does
        """
        print self.lastname, "does stuff"

    def __repr__(self):
        """
        return the string representation for this Employee
        """
        return "<Employee: lastname=%s salary=%d>" % (self.lastname,
            self.salary)

class Chef(Employee):     # Chef is now a subclass of Employee;
    """
    Chef class is a subclass of Employee who handles cooking
    """
    def __init__(self, lastname, maxMich=0):     # overloading
        """
        Chef constructor: Chef's salaries are initially 50000,
            but their highest Michelin rating needs to be noted
            (assumed to be 0 if not given)
        """
        Employee.__init__(self, lastname, 50000)
        self.maxMich = maxMich

    def work(self):		    # overloading
        """
        Prints to the screen a Chef's job description
        """
        print self.lastname, "makes food"

    def setMaxMich(self, newRating):
        """ 
        update this Chef's maximum Michelin rating;
            (will NOT decrease it; is ignored if proposed
   	         new rating is lower)
        """
        self.maxMich = max(self.maxMich, newRating)

    def __repr__(self):
        """
        return a string representation of a Chef
        """
        partial = Employee.__repr__(self)
        return partial[0:-1] + " maxMich=%d>" % self.maxMich