/**
 * A utility class that can be used to calculate state taxes.
 *
 * In this case, there is a sales tax on all items but
 * (non-prepared) food has a special exemption.
 *
 *
 * This work complies with the JMU Honor Code.
 *
 * @author  Matt Serone
 * @version 1.3 Date - Sept. 16, 2008
 */
public class StateTaxes
{
    private static double FOOD_EXEMPTION_RATE = 0.02;
    private static double SALES_TAX_RATE      = 0.05;
    

    /**
     * Calculate the exemption on (non-prepared) food
     *
     * @param value   The value of the (non-prepared) food
     * @return        The exemption (in dollars)
     */
    public static double foodExemption(double value)
    {
       double   exemption;
	   
	   exemption = 0.0;
	   
	   if(value >= 0.0)
	   //if the value is greater or equal to zero
	   {
	   	  exemption = value * FOOD_EXEMPTION_RATE;
	   	  //the exemption is 2% of the value
	   }//end if

       return exemption;       
    }//end foodExemption()


    /**
     * Calculate the tax on (non-prepared) food.
     *
     * The food tax is the sales tax less the food exemption.
     *
     * @param value   The value of the (non-prepared) food
     * @return        The tax (in dollars)
     */
    public static double foodTax(double value)
    {
       double   tax;

       tax = 0.0;
       
	   if(foodExemption(value) > salesTax(value))
	   //if the foodExemption is greater than the
	   //salesTax
	   {
	   	   //tax stays the same
	   }//end if
	   else
	   {
	   	   tax = (salesTax(value) - foodExemption(value));
	   	   //tax is the salesTax minus the foodExemption
	   }//end else if
       
       return tax;       
    }//end foodTax()
    


    /**
     * Calculate the sales tax.
     *
     * @param value   The value of the items
     * @return        The tax (in dollars)
     */
    public static double salesTax(double value)
    {
       double    tax;
       
       tax = 0.0;
       
       if(value < 0.20)
       {
       	  //tax stays the same
       }//end if
       else if(value >= 0.0)
       {
          tax = value * SALES_TAX_RATE;
	      //the tax is 5% of the total value
       }//end else if

       return tax;       
    }//end salesTax()
}//end StateTaxes class
