Exemple #1
0
        public static void OrderPastries(int count)
        {
            Pastry pastry = new Pastry();

            mainOrderCount++;
            if (pastryOrderCount < 1)
            {
                Console.WriteLine("How many pastries would you like to order? They are $2 each, or 2 for $3.");
                orderNumPastries = int.Parse(Console.ReadLine());
                Console.WriteLine("You have ordered " + orderNumPastries + " pastries. Should we complete your order? ('Yes' | 'No')");
                string answer = Console.ReadLine();
                if (answer == "Yes")
                {
                    double totalPastry = pastry.TotalPricePastry(orderNumPastries);
                    orderTotal += totalPastry;
                    End();
                }
                else if (answer == "No")
                {
                    pastryOrderCount++;
                    double totalPastry = pastry.TotalPricePastry(orderNumPastries);
                    orderTotal += totalPastry;
                    Main();
                }
            }
            else
            {
                Console.WriteLine("How many more pastries would you like to order? As a reminder, they are $2 each, or 2 for $3");
                int orderNum2 = int.Parse(Console.ReadLine());
                Console.WriteLine("You have ordered " + orderNum2 + " more pastries. Should we complete your order? ('Yes' | 'No')");
                string answer2 = Console.ReadLine();
                if (answer2 == "Yes")
                {
                    orderNumPastries = orderNum2;
                    double totalPastry = pastry.TotalPricePastry(orderNumPastries);
                    orderTotal += totalPastry;
                    End();
                }
                else if (answer2 == "No")
                {
                    double totalPastry = pastry.TotalPricePastry(orderNumPastries);
                    orderTotal += totalPastry;
                    Main();
                }
            }
        }