Exemplo n.º 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());
        }
Exemplo n.º 2
0
 public Bill(IPercentageDiscount percentageDiscount)
 {
     _percentageDiscount = percentageDiscount;
     Items = new HashSet <Item>();
 }
 public void Start()
 {
     _percentageDiscount = new Employee();
     _billingService     = new BillingService(_percentageDiscount, new BillDiscount());
 }
Exemplo n.º 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());
 }
Exemplo n.º 6
0
 public BillCalculator(IPercentageDiscount percentageDiscountCalculator, IFixedDiscount fixedDiscountCalculator)
 {
     FixedDiscountCalculator      = fixedDiscountCalculator;
     PercentageDiscountCalculator = percentageDiscountCalculator;
 }
Exemplo n.º 7
0
 public void Start()
 {
     _percentageDiscount = new Affiliate();
     _billingService     = new BillingService(_percentageDiscount, new BillDiscount());
 }