public int GetBillingAmount(int amount) { // strategy to choose type of discount int billingAmount; if (amount >= 2000) { discount = new TwentyPercentDiscount(); billingAmount = discount.CalculateDiscount(amount); } else if (amount > 1000) { discount = new TenPercentDiscount(); billingAmount = discount.CalculateDiscount(amount); } else { discount = new FivePercentDiscount(); billingAmount = discount.CalculateDiscount(amount); } return(amount - billingAmount); }
public double CalculateDiscount() { return(_Discount.CalculateDiscount(ProductCost)); }
public double GetDiscount() => _discount.CalculateDiscount(_productPrice);
public double GetDiscout() { return(_discount.CalculateDiscount(_productPrice)); }