private static void PrintItem(VendingMachineItem item, string itemLocation) { Console.WriteLine($"{itemLocation}".PadRight(20) + $"{item.Name}".PadRight(20) + $"{item.Price.ToString("C")}".PadRight(10) + $"{item.DisplayQuantity}"); }
/// <summary> /// Create a log line when an item is purchased /// </summary> /// <param name="item"></param> /// <param name="previousBalance"></param> /// <param name="location"></param> public static void WritePurchaseToLog(VendingMachineItem item, decimal previousBalance, string location) { WriteToLog($"{DateTime.Now} ".PadRight(20) + $"{item.Name} {location}".PadRight(25) + $"{previousBalance.ToString("C")}".PadRight(10) + $"{(previousBalance - item.Price).ToString("C")}".PadRight(20)); }