static void Main(string[] args) { PaymentValidation payValidation = new PaymentValidation(); Checkout checkout = new Checkout(); string finalAnswer = "y"; while (finalAnswer == "y") { checkout = DisplayMenu(checkout); checkout.PaymentChoice(checkout.GrandTotal); PrintReceipt(checkout, checkout.GrandTotal, checkout.Tax, checkout.SubTotal); Console.WriteLine("Would you like to make another transaction? y/n"); finalAnswer = Console.ReadLine().ToLower(); if (finalAnswer == "y") { checkout.SubTotal = 0; checkout.Tax = 0; checkout.GrandTotal = 0; checkout.Cart.Clear(); continue; } else if (finalAnswer == "n") { Console.WriteLine("Have a great day!"); Environment.Exit(1); } } }
static void Main(string[] args) { PaymentValidation payValidation = new PaymentValidation(); Checkout checkout = new Checkout(); bool finalAnswer = true; while (finalAnswer == true) { checkout = DisplayMenu(checkout); checkout.PaymentChoice(checkout.GrandTotal); PrintReceipt(checkout, checkout.GrandTotal, checkout.Tax, checkout.SubTotal); bool isValid = true; while (isValid == true) { Console.WriteLine("Would you like to make another transaction? y/n"); string inputYorN = Console.ReadLine().ToLower(); if (inputYorN == "y") { checkout.Cart.Clear(); checkout.GrandTotal = 0; checkout.Tax = 0; checkout.SubTotal = 0; Console.Clear(); finalAnswer = true; isValid = false; } else if (inputYorN == "n") { Console.WriteLine("Have a great day!"); finalAnswer = false; isValid = false; } else { Console.WriteLine("Invalid try again"); isValid = true; } } } }
static void Main(string[] args) { Menu.DisplayMenu(); Checkout.PaymentChoice(grandTotal); Receipt.PrintReceipt(); }