/**
 * A weight in traditional U.S. units (i.e., pounds and ounces)
 *
 * This version extends the abstract MultiPartMeasure class that
 * implements most behaviors
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 3.0  
 */
 public class Weight extends MultiPartMeasure
 {
    public static final Weight ZERO = new Weight(0,0,true);


    /**
     * Default Constructor
     */
     public Weight()
     {
			this(0, 0, true);
     }


    	/**
       * Explicit Value Constructor
       *
       * @param pounds  The number of pounds (must be positive)
       * @param ounces  The number of ounces (must be positive)
       */
    	 public Weight(int pounds, int ounces)
       {
				this(pounds, ounces, true);
    	 }



    	/**
     	 * Explicit Value Constructor
       *
       * @param pounds   The number of pounds (must be positive)
       * @param ounces   The number of ounces (must be positive)
       * @param positive true for a postive weight, false for negative
       */
    	 public Weight(int pounds, int ounces, boolean positive)
    	 {
			super(2);
	
			amount[0] = ounces;
			amount[1] = pounds;

			sign = 1;
			if (!positive) 
			  	sign = -1;

				// Fix any inconsistencies
			if ((ounces != 0) || (pounds != 0))
			{
	  		  changeBy(ZERO);
			}
    }



	 /**
     * Change this Weight by a given amount
     *
     * @param other   The amount to change this Weight by
     */
     public void changeBy(Weight other)
     {
   	 	super.changeBy(other);
     }



    /**
     * Check to see if this Weight is equal to 
     * a given Weight
     *
     * @param other   The other Weight to use in the comparison
     * @return        true if the two are equal and false otherwise
     */
     public boolean equals(Weight other)
     {
    		return super.equals(other);
     }


    /**
     * Initialize the "constants" used by a TwoPartMeasure
     */
     protected void initializeUnits()
     {
			smallsPerLarge[1] = 16;

			unitsSingular[0] = "pound";
			unitsSingular[1] = "ounce";

			unitsPlural[0]   = "pounds";
			unitsPlural[1]   = "ounces";
     }


}
