/**
 * PartTimer subclass extends Employee superclass 
 * and overrides Employee fields and methods 
 *
 * Also getFullname() no longer needs the client to pass the salutation
 *
 */

public class PartTimer extends Employee                 // extends Employee superclass
{
    
    private static String  companyName = "Helper co.";  // override the companyName
                                                        // from the Employee class

    private static boolean healthPlan = false;          // add class fields      
    
    private int numHours;                               // add instance fields
    private int hourlyRate;

    /**
     * Constructors for objects of class PartTimer
     */

    PartTimer(String title, String last, String first, String x, int old,
              int hours, int rate)   
    {
        super(title, last, first, x, old);           // call superclass constructor
                                                     // pass it title,last,first,sex,age
        numHours   = hours;
        hourlyRate = rate;  
    }


    /**
     * override the superclass methods
     */

    public String getFullname( )            // implements getFullname()
    {
        String salutation;
        String sex = getGender( );

        if (sex.equalsIgnoreCase("M"))          //using the interface constants.
            salutation = "Mr.";                 //Now I no longer need the client
        else                                    //to pass me the salutation.
            salutation = "Ms.";

        String fullname  = salutation + " " + getFirstname()   + " " + getLastname();
               fullname += "\t Part timer-Employee of " + companyName;
        return (fullname);
    }

    public int getWeekPay( )                     //implements salary( )                
    {
        return (numHours * hourlyRate);
    }

    public String toString ( )                          // override the toString()
    {
        String data = super.toString()  + "\n" +        //call the superclass toString()
                      "Number Hours: " + numHours    + "\t" +
                      "Hourly Rate: "  + hourlyRate  + "\t" +
                      " Income: "      + getWeekPay() + "\n";
        return (data);
    }
}