public IProductPriceHandler GetResult() { AddedExpenses.CalculateExpenses(); CalculateUpcDiscount(); Total = Product.Price + TaxResult - DiscountResult - DiscountForUpcResult + AddedExpenses.TotalOfExpenses; return(this); }
public void DisplayProduct() { var result = CalculateTax().CalculateDiscount().GetResult(); //var result = CalculateTax().CalculateDiscount().CalculateUpcDiscount().GetResult(); // Product & Price Console.WriteLine($"Product {result.Product.Name}, was purchased for {result.Product.Price.DecimalPlaces(2).CurrencyStr()}"); // Tax Report Console.WriteLine($"A {result.Tax.ToPercentage().PercentageStr()} tax, resulted in a tax of {result.TaxResult.DecimalPlaces(2).CurrencyStr()}"); // Discount Report Console.WriteLine($"A {result.Discount.ToPercentage().PercentageStr()} discount, resulted in a discount of {result.DiscountResult.DecimalPlaces(2).CurrencyStr()}"); // Discount UPC Report Console.WriteLine($"A {result.DiscountForUpc.ToPercentage().PercentageStr()} discount for UPC {result.Product.UPC}, resulted in a discount of {result.DiscountForUpcResult.DecimalPlaces(2).CurrencyStr()}"); AddedExpenses.DisplayAllAddedExpenses(); Console.WriteLine($"The total for all 'Added Expenses' is {AddedExpenses.TotalOfExpenses.DecimalPlaces(2).CurrencyStr()}"); // Total Console.WriteLine($"For a total with tax and discount and UPC-Discount of: {result.Total.DecimalPlaces(2).CurrencyStr()}"); Console.WriteLine(); }