/**
 * 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  Your Name
 * @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;
       
       //if else statement calculates 2% tax
      //on the value passed
         if(value >=0)
         {
            exemption = value * FOOD_EXEMPTION_RATE;
         }//end if
         else
         {
            exemption = 0.0;
         }//end else  
       
          
         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;
         double exemptionRate;		
      
         tax =  salesTax(value) - foodExemption(value);
      	
      //if the food exemption is more than the tax
      //it is set to 0		
         if (tax <=0)
         {
            tax = 0;
         }//end 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;
       //if statement taxes 5% if value is more
       //than $0.20
         if (value >= .20)  
         {
            tax = value * SALES_TAX_RATE;
         }//end if
         
         else
         {
            tax = 0.00;
         }//end else      
      
         
         return tax;       
      }//end salesTax
    
   
   
   }
