/// <summary> /// Calculates a tax for an item rounded up to the nearest nickel. /// </summary> /// <param name="price">The base price for calculating the tax.</param> /// <param name="basicTaxExemption">Indicates the exemption status of an Item.</param> /// <param name="imported">true indicates the Item is subject to import tariff.</param> /// <returns></returns> public static decimal CalcTax( decimal price, BasicExempt basicTaxExemption, bool imported = false) { decimal tax = BasicTax(price, basicTaxExemption); if (imported) { tax += ImportTax(price); } tax = RoundUpToNearestNickel(tax); return(tax); }
private static decimal BasicTax(decimal price, BasicExempt basicTaxExemption) { decimal tax = 0m; switch (basicTaxExemption) { case SalesTax.BasicExempt.Book: case SalesTax.BasicExempt.Food: case SalesTax.BasicExempt.Medicine: break; default: tax = Decimal.Round(price * .10m, 2); break; } return(tax); }