public static void GetList() { List <BakeryItem> bakeryResult = BakeryItem.GetAll(); double bakeryTotalPrice = 0; foreach (BakeryItem item in bakeryResult) { bakeryTotalPrice += item.Price; } Console.WriteLine("Your total price is " + bakeryTotalPrice); }
public void MakePurchase(string itemName, int quantity) { int price; if (pastryItems.TryGetValue(itemName, out price)) { BakeryItem pastry = new BakeryItem(itemName, price, quantity); } else if (breadItems.TryGetValue(itemName, out price)) { BakeryItem bread = new BakeryItem(itemName, price, quantity); } else { WriteLine($"Sorry, can't find {itemName} on the menu."); DrawLine(); StartStore(); } }