/// <summary> /// This is the Purchasing Menu. It contains Add Money, Select Products, and Complete Transaction options. /// </summary> public void PurchasingMenu() { bool done = false; while (!done) { Console.WriteLine("(1) Add Money"); Console.WriteLine("(2) Select Products"); Console.WriteLine("(3) Complete Transaction"); Console.WriteLine($"Current Account Balance: ${this.accounting.DisplayMoney()}"); string userInput = Console.ReadLine(); switch (userInput) { // Defaults to this if userInput is anything but 1, 2, or 3. default: Console.WriteLine("Please select an appropriate option."); break; //Add Money case "1": Console.Write("How much money would you like to add to your account? "); try { int amountToAdd = int.Parse(Console.ReadLine()); this.AddMoney(amountToAdd); files.AccountPurchasesLog(accounting, "Added", amountToAdd); } catch (FormatException ex) { Console.WriteLine("Please use whole number values only. " + "(" + ex.Message + ")"); } break; // Select Products case "2": if (accounting.DisplayMoney() == 0.00M) { Console.WriteLine("Please deposit money into your account before trying to make a purchase."); break; } Console.WriteLine("Which product would you like to add to your cart? "); string userProductCode = Console.ReadLine().ToUpper(); this.SelectProduct(userProductCode); break; // Complete Transaction case "3": DisplayPurchaseReport(); files.AccountPurchasesLog(accounting, "Change", 0); accounting.ResetBalance(); done = true; break; } } }