Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            Product          a = new Product();
            Product          b = new Product("Ice-cream", 0.5);
            OrderLine        c = new OrderLine(a, 2);
            OrderLine        d = new OrderLine(b, 3);
            List <OrderLine> q = new List <OrderLine>();

            q.Add(c); q.Add(d);
            Order w = new Order(q);

            List <IPromotionalProgram> listP     = new List <IPromotionalProgram>();
            EveryFifthProduct          discount1 = new EveryFifthProduct();
            TotalSumDiscount           discount2 = new TotalSumDiscount();
            ExpensiveProductDiscount   discount3 = new ExpensiveProductDiscount();

            listP.Add(discount1);
            listP.Add(discount2);
            listP.Add(discount3);


            Customer p = new Customer(w, listP);

            p.startOrder();
            p.buy(new Product("Nesquik", 2), 3);
            p.buy(new Product("Milk", 1), 1);
            p.buy(new Product("Cheese", 0.20), 1);
            p.buy(new Product("Bread", 1), 1);
            p.buy(new Product("Butter", 1.5), 1);
            p.buy(new Product("Yogurt", 0.4), 6);
            p.commitOrder();


            //Console.WriteLine("{0:C}", 10);
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            List <IPromotionalProgram> listP     = new List <IPromotionalProgram>();
            EveryFifthProduct          discount1 = new EveryFifthProduct();
            TotalSumDiscount           discount2 = new TotalSumDiscount();
            ExpensiveProductDiscount   discount3 = new ExpensiveProductDiscount();

            listP.Add(discount1);
            listP.Add(discount2);
            listP.Add(discount3);


            Customer p = new Customer(listP);

            p.startOrder();
            p.buy(new Product("Ice-cream", 0.4), 5);
            p.buy(new Product("Chocolate", 1), 4);
            p.commitOrder();

            p.startOrder();
            p.buy(new Product("Nesquik", 2), 3);
            p.buy(new Product("Milk", 1), 1);
            p.buy(new Product("Cheese", 0.20), 1);
            p.buy(new Product("Bread", 1), 1);
            p.buy(new Product("Butter", 1.5), 1);
            p.buy(new Product("Yogurt", 0.4), 6);
            p.commitOrder();

            p.startOrder();
            p.buy(new Product("Pepsi", 3), 2);
            p.buy(new Product("Snikers", 1), 3);
            p.buy(new Product("Nesquik", 2), 1);
            p.buy(new Product("Kit-kat", 0.5), 4);
            p.buy(new Product("Mars", 0.7), 2);
            p.commitOrder();

            p.startOrder();
            p.buy(new Product("Pepsi", 3), 2);
            p.buy(new Product("Snikers", 1), 3);
            p.buy(new Product("Nesquik", 2), 1);
            p.buy(new Product("Kit-kat", 0.5), 4);
            p.buy(new Product("Mars", 0.7), 2);
            p.commitOrder();

            p.startOrder();
            p.buy(new Product("Nesquik", 2), 3);
            p.buy(new Product("Milk", 1), 1);
            p.buy(new Product("Cheese", 0.20), 1);
            p.buy(new Product("Bread", 1), 1);
            p.buy(new Product("Butter", 1.5), 1);
            p.buy(new Product("Yogurt", 0.4), 6);
            p.commitOrder();
        }