/*                                      
 * Performer.java 
 *
 * Version: 
 *     $Id: Performer.java,v 1.1 2002/03/17 12:48:15 jmg Exp $ 
 * 
 * Revisions: 
 *     $Log: Performer.java,v 
 *     Revision 1.1  2002/03/17 12:48:15  jm
 *     Initial revisio
 * 
 */

/**
 * Performer class.  Abstract class representing a prformer that needs to 
 * get paid
 *
 * @author Joe Geigel
 */
public abstract class Performer implements Comparable {

    /**
     * The performer's name
     */
    private String myName;

    /**
     * The rate of pay per performance
     */
    private double payPerPerf;

    /**
     * The number of perfomances worked
     */
    private int nPerformances;


    /**
     * Constructs a performer
     *
     * @param name the performer's name
     * @param rate the amount paid to the performer per performance
     */
    protected Performer (String name, double rate)
    {
	myName = name;
	payPerPerf = rate;
	nPerformances = 0;
    }

    /**
     * Caculates and returns the weekly pay
     *
     */
    public abstract double calculatePay();


    /**
     * Calculates the base pay for the week based on the number of 
     * performances played
     *
     * @return The base weekly pay
     */
    protected double getBasePay()
    {
	return nPerformances * payPerPerf;
    }

    /**
     * Sets the number of performances for the week
     *
     * @param n number of performances played during the week
     */
    public void perform (int n)
    {
	nPerformances = n;
    }

    
    public int compareTo (Object O)
    {
	Performer P = (Performer)O;

	return myName.compareTo (P.myName);
    }
}
