Exemple #1
0
        public double getPrice(IFactoryDiscount factory)
        {
            double total = 0;

            foreach (var p in products)
            {
                total += p.Price;
            }

            if (_Discount.Equals("InCash"))
            {
                inCash.Discount(total);
            }

            if (_Discount.Equals("Debit"))
            {
                debit.Discount(total);
            }

            if (_Discount.Equals("ParceledOut"))
            {
                parceledOut.Discount(total);
            }

            return(total);
        }
Exemple #2
0
        public Discount()
        {
            if (_Discount.Equals("InCash"))
            {
                factory = (IFactoryDiscount) new InCash();
            }

            if (_Discount.Equals("Debit"))
            {
                factory = (IFactoryDiscount) new Debit();
            }

            if (_Discount.Equals("ParceledOut"))
            {
                factory = (IFactoryDiscount) new ParceledOut();
            }
        }