예제 #1
0
        private static void Billing(IPercentageDiscount percentageDiscount)
        {
            var billingService = new BillingService(percentageDiscount, new BillDiscount());

            billingService.AddItem(new OtherItem {
                Name = "Laptop", Price = 50000
            });
            billingService.AddItem(new OtherItem {
                Name = "Mobile", Price = 20000
            });
            billingService.AddItem(new GroceryItem {
                Name = "Rice", Price = 1000
            });
            Console.WriteLine(billingService.PrintBill());
        }
예제 #2
0
 public Bill(IPercentageDiscount percentageDiscount)
 {
     _percentageDiscount = percentageDiscount;
     Items = new HashSet <Item>();
 }
 public void Start()
 {
     _percentageDiscount = new Employee();
     _billingService     = new BillingService(_percentageDiscount, new BillDiscount());
 }
예제 #4
0
 public BillingService(IPercentageDiscount percentageDiscount, IBillDiscount billDiscount)
 {
     _bill         = new Bill(percentageDiscount);
     _billDiscount = billDiscount;
 }
 public void Start()
 {
     _percentageDiscount = new RegularCustomer();
     _billingService     = new BillingService(_percentageDiscount, new BillDiscount());
 }
예제 #6
0
 public BillCalculator(IPercentageDiscount percentageDiscountCalculator, IFixedDiscount fixedDiscountCalculator)
 {
     FixedDiscountCalculator      = fixedDiscountCalculator;
     PercentageDiscountCalculator = percentageDiscountCalculator;
 }
예제 #7
0
 public void Start()
 {
     _percentageDiscount = new Affiliate();
     _billingService     = new BillingService(_percentageDiscount, new BillDiscount());
 }