コード例 #1
0
        public static void AddPastry(Pastry pastry, Bread bread)
        {
            Console.ForegroundColor = ConsoleColor.DarkCyan;
            Console.WriteLine("Enter the # of pastries you would like to purchase:");

            int pastryNo = int.Parse(Console.ReadLine());

            if (pastryNo != 0)
            {
                pastry.PastryInvoice(pastryNo);
                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.WriteLine("Bread Loaf Quantity: " + pastry.Quantity + "." + " " + "Your pastry total is: " + pastry.Price + "$");

                Console.ForegroundColor = ConsoleColor.DarkCyan;
                Console.WriteLine("Would you like to add anything else to your order? Type y to add bread or n to checkout.");
                string addBread = Console.ReadLine();
                if (addBread == "y" || addBread == "Y")
                {
                    AddBread(bread, pastry);
                }
                else
                {
                    CheckOut(bread, pastry);
                }
            }
        }