private double CalculateTax(Product product) { double taxToApply = 0; BaseTax baseTax = new BaseTax(product); double calculatedBaseTax = baseTax.Calculate(); taxToApply += calculatedBaseTax; if (product.Category == ProductCategory.Other) { RegularTax regularTax = new RegularTax(product); double calculatedRegularTax = regularTax.Calculate(); taxToApply += calculatedRegularTax; } if (product.IsImported) { ImportTax importTax = new ImportTax(product); double calculatedImportTax = importTax.Calculate(); taxToApply += calculatedImportTax; } return(taxToApply); }
public void Calculate(BaseTax tax) { tax.Calculate(); }