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);
        }
Esempio n. 2
0
 public double CalculateDiscount()
 {
     return(_Discount.CalculateDiscount(ProductCost));
 }
Esempio n. 3
0
 public double GetDiscount() => _discount.CalculateDiscount(_productPrice);
Esempio n. 4
0
 public double GetDiscout()
 {
     return(_discount.CalculateDiscount(_productPrice));
 }