static void Main(string[] args) { //Boolean to repeat or stop doWhile bool startOver = false; do { //Clearing the Console mainly for the second order Console.Clear(); //Generating Lists to hold products and items you are shopping for List <Product> productList = new List <Product>(); List <Product> shoppingCart = new List <Product>(); //Assigning Products to ProductList productList = Product.GetProductList(); int inputValue = 0, itemSelected = 0, quantity = 0, cartQuantity = 0; string userInput; bool accessGranted = false; Console.WriteLine("Welcome to GC Electronics!"); Console.WriteLine("\nWhat would you like to do today?"); //Calling Method to Display the actions a user can take DisplayActionList(); inputValue = Validation.ValidInput(Console.ReadLine()); //If user enters a 1, they will go into the shopping area if (inputValue == 1) { bool continueShopping = false; do { //Clearing the screen of the previous code to keep it looking neat Console.Clear(); Console.WriteLine("Welcome to the shop!\n"); //Sends the Product List to a void method containing a foreach to iterate through the list that will also sort it DisplayItems(productList); //Displays the number of items user has in their shopping cart if they are adding more than a single item if (shoppingCart.Count > 0) { cartQuantity = 0; foreach (var item in shoppingCart) { cartQuantity = cartQuantity + item.Quantity; } Console.WriteLine($"\nCurrent Item(s) in Shopping Cart: {cartQuantity}"); } //Asking user to select product Console.WriteLine("\nPlease add an item to your cart by typing in the number to the left of the item"); itemSelected = Validation.ValItemFromList(Console.ReadLine(), productList.Count); //Asking user to input quantity Console.WriteLine("\nHow many would you like to add?"); quantity = Validation.ValidAmount(); //Adding item and quantity selected to shopping cart shoppingCart.Add(AddToCart(productList, itemSelected, quantity)); //Allowing user to add more items or head to checkout Console.WriteLine("\nWould you like to add another item to your cart or proceed to checkout?\nPlease type in \"continue\" or \"checkout\""); continueShopping = Validation.ToContinue(Console.ReadLine()); } while (continueShopping == true); //Sends shopping cart to payment selections and payment screen PaymentChoice(shoppingCart); //Allows user to create another transaction or close pos Console.WriteLine("\nWould you like to make another transaction or close the terminal?\nPlease type in \"Restart\" or \"Close\""); startOver = Validation.RestartOrClose(Console.ReadLine()); } //allows user to add or remove product if they have the admin password else if (inputValue == 2) { //this section only allows 3 attempts to put in password else it returns to main menu for (int i = 1; i < 4; i++) { Console.WriteLine("Please enter the administrative password"); userInput = Console.ReadLine(); if (userInput == "gcAdmin") { i = 50; accessGranted = true; } else { Console.WriteLine($"Password was incorrect. You have {3-i} attempt(s) left"); } } if (accessGranted == true) { Product.ModifyProductList(productList); startOver = true; } else { Console.WriteLine("Access denied. You will be returned to the main menu in 5 seconds"); startOver = true; Thread.Sleep(5000); } } else { startOver = false; } } while (startOver == true); Console.WriteLine("Thank you for using the POS"); }