/**
 * PartTimer subclass extends Employee superclass 
 * and overrides Employee fields and methods 
 *
 */

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 variables      
    
    private int numHours;                               // add instance variables
    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
     */

    String getFullname ( )                              // override the getFullname()
    {
        String sex = getGender();
        String salutation = (sex.equals("M")) ? "Mr." : "Ms.";

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

        return (fullname);
    }

    int getWeekPay( )                                   //override getWeekPay()                
    {
        return (numHours * hourlyRate);                 //compute weekly pay
    }

    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);
    }
}