public void Display() { while (true) { Console.WriteLine(); Console.WriteLine("(1) Feed Money"); Console.WriteLine("(2) Select Product"); Console.WriteLine("(3) Finish Transaction"); Console.WriteLine(); string input = Console.ReadLine(); if (input == "1") { try { Console.WriteLine("How many dollars would you like to insert?"); int fedMoney = Int32.Parse(Console.ReadLine()); logger.RecordDeposit(fedMoney, (VM.CurrentBalance + fedMoney)); VM.FeedMoney(fedMoney); } catch (FormatException) { Console.Beep(); Tools.ColorfulWriteLine("Please only enter a whole Dollar Value", ConsoleColor.Red); } } else if (input == "2") { Console.WriteLine("Please select your product."); Console.WriteLine(); string slotId = Console.ReadLine().ToUpper(); VendingMachineItem productSelected = VM.GetItemAtSlot(slotId); if (productSelected != null) { totalProductsSelected.Add(productSelected); logger.RecordPurchase(productSelected.Name, slotId, VM.CurrentBalance, VM.CurrentBalance - productSelected.Price); } } else if (input == "3") { change = VM.returnChange(); Console.WriteLine("Your change is:"); Console.WriteLine(change.Quarters + " in quarters, " + change.Dimes + " in dimes, " + change.Nickels + " in nickels"); Console.WriteLine(); logger.RecordCompleteTransaction(change.TotalChange, VM.CurrentBalance); for (int i = 0; i < totalProductsSelected.Count; i++) { Console.WriteLine(totalProductsSelected[i].Consume()); } break; } else { Console.WriteLine("You did not enter a valid option?"); } Console.WriteLine(VM.CurrentBalance.ToString("C")); } }
private void PrintHeader() { Tools.ColorfulWrite("WELCOME!", ConsoleColor.Yellow); Console.WriteLine(); }