示例#1
0
        public void CompleteTransaction()
        {
            catering.PrintReceipt();
            Console.WriteLine();
            Console.WriteLine("Are you sure you would like to make this purchase?");
            Console.WriteLine("(1) Yes");
            Console.WriteLine("(2) No");
            string userInput = Console.ReadLine();

            switch (userInput)
            {
            case "1":
                if (catering.Balance < catering.total)
                {
                    Console.WriteLine("You do not have sufficient funds. Please add more money to your account.");
                    Console.WriteLine("(1) Return To Main Menu");
                    Console.ReadLine();
                }
                else
                {
                    catering.PurchaseConfirmation();
                    Console.WriteLine("Thank you for your business! ");
                }
                MainMenu();
                break;

            case "2":
                MainMenu();
                break;

            default:
            {
                Console.WriteLine("That is not a valid answer. Please enter '1' or '2'.");
            }
            break;
            }
            Console.ReadLine();
        }