Пример #1
0
        public static void TakeOrder()
        {
            int loafAmt   = 0;
            int danishAmt = 0;

            Console.ForegroundColor = ConsoleColor.DarkBlue;
            Console.WriteLine("Our hostess will now take your order!");
            Console.WriteLine("How many artisanal loaves would you like to purchase?");
            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");

            string loaf      = Console.ReadLine();
            bool   loafParse = int.TryParse(loaf, out loafAmt);

            Console.WriteLine("How many artisanal danish's would you like to purchase?");

            string danish      = Console.ReadLine();
            bool   danishParse = int.TryParse(danish, out danishAmt);

            if (loafParse && danishParse && loafAmt >= 0 && danishAmt >= 0)
            {
                Bread  customerLoaf   = new Bread(loafAmt);
                Pastry customerDanish = new Pastry(danishAmt);

                Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
                Console.ForegroundColor = ConsoleColor.DarkMagenta;
                Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");

                Console.WriteLine("Thank you for giving Pierre's Bakery your buisness. Your Total is: $" + (customerDanish.GrabDanish() + customerLoaf.GrabLoaf()));

                Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.DarkRed;
                Console.WriteLine("Sorry, you can only purchase whole loaves & danishes!");
            }
        }