コード例 #1
0
 public static string VerifyPurchaseAnotherProduct(string userInput)
 {
     if (userInput.ToLower() == "yes" || userInput.ToLower() == "no")
     {
         return(userInput);
     }
     else
     {
         Console.WriteLine($"\"{userInput}\": is not a valid entry. Please enter yes or no.");
         ConsoleLogging.PurchaseAnotherProduct();
         return(userInput);
     }
 }
コード例 #2
0
        static void Main(string[] args)
        {
            bool complete;

            do
            {
                Console.Clear();
                Cart.GetItemDetails();

                complete = (ConsoleLogging.PurchaseAnotherProduct() == "no");
            } while (complete == false);

            Console.Clear();
            Receipt.PrintReceipt();
        }