/**
 * 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  Yang Yang
 * @version 1.0 	Sep,11th,2008
 */
public class StateTaxes
{
    //Hold the food exemption rate and sales tax rate
	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;//Hold the exemption
       
       //Calculate the exemption
       if(value <0.20)
    	   exemption = 0.0;
       else
    	   exemption = FOOD_EXEMPTION_RATE*value;

       return exemption;//Return the exemption   
    
    }//end foodExemption method


    /**
     * 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;//Hold the food tax
       
       //Calculate the food tax
       tax = salesTax(value) - foodExemption(value);
       
       return tax;//Return tax
       
    }//End foodTax method
    


    /**
     * Calculate the sales tax.
     *
     * @param value   The value of the items
     * @return        The tax (in dollars)
     */
    public static double salesTax(double value)
    {
       double    tax;//Hold the tax
      
       //Calculate the tax
       if(value < 0.20)
    	   tax = 0.0;
       else
    	   if (value < 0)
    		   tax = 0.0;
    	   else
    		   tax = value*SALES_TAX_RATE;      
           
       return tax;//Return tax       
    
    }//End salesTax method
    
}//End StateTaxes class
