Пример #1
0
        public static void MainMenu()
        {
            Console.WriteLine("please type in 'bread' for bread options or 'pastry' for pastry options.");
            string menuOption = Console.ReadLine().ToLower();

            if (menuOption == "bread")
            {
                Console.WriteLine("Todays specials! Buy 2, get 1 free. A single loaf costs $5.");
                Console.WriteLine("How many loafs would you like to order?");
                int   breadOrder      = int.Parse(Console.ReadLine());
                Bread newBreadOrder   = new Bread(breadOrder);
                int   firstBreadOrder = newBreadOrder.AddBreadCost();
                totalBreadList.Add(firstBreadOrder);
                Console.WriteLine($"Total: ${newBreadOrder.AddBreadCost()}");
                CheckOut();
            }
            else if (menuOption == "pastry")
            {
                Console.WriteLine("Todays specials! Buy 1 for $2 or 3 for $5.");
                Console.WriteLine("How many pastries would you like to order?");
                int    pastryOrder      = int.Parse(Console.ReadLine());
                Pastry newPastryOrder   = new Pastry(pastryOrder);
                int    firstPastryOrder = newPastryOrder.AddPastryItem();
                totalBreadList.Add(firstPastryOrder);
                Console.WriteLine($"Total: ${newPastryOrder.AddPastryItem()}");
                CheckOut();
            }
        }
Пример #2
0
        public static void Main()
        {
            Console.WriteLine("Welcome to Pierre's Bakery");
            Console.WriteLine("Loaves of Bread are $5.00 each, buy two get one free!");
            Console.WriteLine("Pastries are $2.00 each, three for $5.00!");
            Console.WriteLine("How many Loaves of Bread would you like?");
            Bread inputBreadQuantity = new Bread(int.Parse(Console.ReadLine()));
            int   outputBreadCost    = inputBreadQuantity.SubtractBreadDiscount(inputBreadQuantity.AddBreadCost());

            Console.WriteLine("How many Pastries would you like?");
            Pastry inputPastryQuantity = new Pastry(int.Parse(Console.ReadLine()));
            int    outputPastryCost    = inputPastryQuantity.SubtractPastryDiscount(inputPastryQuantity.AddPastryCost());
            int    outputTotalCost     = outputPastryCost + outputBreadCost;

            Console.WriteLine(" Your total is $" + outputTotalCost + ".00");
        }