Пример #1
0
        //A method for placing an order
        public static void Order(string orderName)
        {
            Console.WriteLine($"Okay, {orderName}, how many loaves of bread would you like?  They're $5 a loaf, but if you buy two, you get one for free!");
            int orderBread = int.Parse(Console.ReadLine());

            Console.WriteLine("How many pastries would you like?  They're $2 a each, or $5 for 3!");
            int    orderPastry = int.Parse(Console.ReadLine());
            Bread  bread       = new Bread(orderBread);
            Pastry pastry      = new Pastry(orderPastry);

            bread.FindBreadPrice();
            pastry.FindPastryPrice();
            int orderTotal = bread.BreadOrderPrice + pastry.PastryOrderPrice;

            Console.WriteLine($"Your total is ${orderTotal}. ${bread.BreadOrderPrice} for {orderBread} loaves of bread and ${pastry.PastryOrderPrice} for {orderPastry} pastries.");
            Console.WriteLine($"Please send {orderTotal} to $rewpet on the cashapp.");
            Console.WriteLine("Would you like to make another order? y/n");
            string answer = Console.ReadLine();

            if (answer == "y" || answer == "Y")
            {
                Order(orderName);
            }
            else
            {
                Console.WriteLine("Thanks for your business!");
            }
        }