Beispiel #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());
        }
Beispiel #2
0
 public Bill(IPercentageDiscount percentageDiscount)
 {
     _percentageDiscount = percentageDiscount;
     Items = new HashSet <Item>();
 }
 public void Start()
 {
     _percentageDiscount = new Employee();
     _billingService     = new BillingService(_percentageDiscount, new BillDiscount());
 }
 public BillingService(IPercentageDiscount percentageDiscount, IBillDiscount billDiscount)
 {
     _bill         = new Bill(percentageDiscount);
     _billDiscount = billDiscount;
 }
 public void Start()
 {
     _percentageDiscount = new RegularCustomer();
     _billingService     = new BillingService(_percentageDiscount, new BillDiscount());
 }
Beispiel #6
0
 public BillCalculator(IPercentageDiscount percentageDiscountCalculator, IFixedDiscount fixedDiscountCalculator)
 {
     FixedDiscountCalculator      = fixedDiscountCalculator;
     PercentageDiscountCalculator = percentageDiscountCalculator;
 }
Beispiel #7
0
 public void Start()
 {
     _percentageDiscount = new Affiliate();
     _billingService     = new BillingService(_percentageDiscount, new BillDiscount());
 }