Exemple #1
0
        private static void ShowPayCost(ICustomer customer, IShoppingBag shoppingBag)
        {
            var expensesCalculator = ShoppingFactory.GetExpensesCalculator(shoppingBag, customer);

            Console.WriteLine($"Product total cost: ${ expensesCalculator.GetTotalCost() }");
            Console.WriteLine($"Product total discount: ${ expensesCalculator.GetTotalDiscount() }");
            Console.WriteLine("Vat percentage is 7%.");
            Console.WriteLine($"Total pay: ${ expensesCalculator.GetTotalPay() }");
        }
Exemple #2
0
        private static void ShowMedicineDiscount(IShoppingBag shoppingBag, ICustomer customer)
        {
            IDiscountor medicineDiscountor    = ShoppingFactory.GetMedicineDiscountor(shoppingBag, customer);
            double      medicineTotalDiscount = medicineDiscountor.GetTotalDiscount();

            if (medicineTotalDiscount > 0)
            {
                Console.WriteLine($"Discount from medicine promotion: ${ medicineTotalDiscount }");
            }
        }
Exemple #3
0
        private static void ShowSnackDiscount(IShoppingBag shoppingBag)
        {
            IDiscountor snackDiscountor    = ShoppingFactory.GetBuyTwoGetOneFreeSnackDiscountor(shoppingBag);
            double      snackTotalDiscount = snackDiscountor.GetTotalDiscount();

            if (snackTotalDiscount > 0)
            {
                Console.WriteLine($"Discount from snack promotion: ${ snackTotalDiscount }");
            }
        }
Exemple #4
0
        private static void ShowFurnitureDiscount(IShoppingBag shoppingBag)
        {
            IDiscountor furnitureDiscountor    = ShoppingFactory.GetFurnitureDiscountor(shoppingBag);
            double      furnitureTotalDiscount = furnitureDiscountor.GetTotalDiscount();

            if (furnitureTotalDiscount > 0)
            {
                Console.WriteLine($"Discount from furniture promotion: ${ furnitureTotalDiscount }");
            }
        }
Exemple #5
0
        private void SelectProduct()
        {
            MessageLogger.ShowSelectProductNumber();
            int selectProductNumber = MessageLogger.AskSelectProductNumber();

            switch (selectProductNumber)
            {
            case 1:
                _product = ShoppingFactory.GetProduct(ProductName.Snack, 100);
                break;

            case 2:
                _product = ShoppingFactory.GetProduct(ProductName.Book, 239);
                break;

            case 3:
                _product = ShoppingFactory.GetProduct(ProductName.Furniture, 299);
                break;

            case 4:
                _product = ShoppingFactory.GetProduct(ProductName.KitchenEquipment, 259);
                break;

            case 5:
                _product = ShoppingFactory.GetProduct(ProductName.Medicine, 200);
                break;

            default:
                break;
            }

            int quantity = MessageLogger.AskProductQuantity(_product.Name.ToString());

            for (int i = 0; i < quantity; i++)
            {
                _shoppingBag.AddProduct(_product);
            }
        }