/**
 * 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  Greg Tamargo
 * @version 1.0
 */
    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;//zero by default
         
         if(value>0)//in case a negative value is entered
                   //it won't be assigned
            exemption=value*FOOD_EXEMPTION_RATE;
            //multiplies the price by the exemption rate
      	  //to get the examption value
      
         return exemption;       
      }//end of 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;
      
         tax = 0.0;//zero by default
         
         if(!(foodExemption(value)>=salesTax(value)))
          //nothing happens if the sales tax is greater
         //than the exemption
            tax = (salesTax(value)-foodExemption(value));
       
         return tax;       
      }//end of 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;
       
         tax = 0.00;//zero by default    
         
         if(value>=.2)//tax doesn't apply below ¢20
            tax=value*SALES_TAX_RATE;
            //tax is the price multiplied by the
      	  //tax rate
      
         return tax;       
      }//end of method
   
   }//end of class
