Example #1
0
        public static void Main(string[] args)
        {
            var discountManager = new DiscountManager();
            var customer        = new Customer
            {
                FirstName = "Gill",
                LastName  = "Bates",
                BirthDay  = DateTime.Today,
                Segment   = 3
            };

            var orderPrice = 1500;

            var discountPrice = orderPrice - discountManager.CalculateDiscount(orderPrice, customer);

            Console.WriteLine(new String('=', 20));
            Console.WriteLine("Order price :   {0}", orderPrice);
            Console.WriteLine("Discount    :   {0}", -orderPrice + discountPrice);
            Console.WriteLine(new String('=', 20));
            Console.WriteLine("Total price :   {0}", discountPrice);
            Console.WriteLine(new String('=', 20));
            Console.ReadKey();
        }
Example #2
0
        public void Sell(Product product, Campaign campaign, User user)
        {
            DiscountManager discountManager = new DiscountManager(new DiscountCheck());

            Console.WriteLine(user.FirstName + " purchased " + product.Name + " for " + discountManager.CalculateDiscount(product, campaign) + "$");
        }