public static int GetTotal() { int breadTotal = Bread.GetPrice(_breadCart.Count); int pastryTotal = Pastry.GetPrice(_pastryCart.Count); return(breadTotal + pastryTotal); }
public static void PrintCart() { Console.WriteLine("\n----------------------"); Console.WriteLine(" [Shpping Cart:] "); Console.WriteLine("----------------------"); List <Bread> breadCart = ShoppingCart.GetBread(); List <Pastry> pastryCart = ShoppingCart.GetPastry(); if (breadCart.Count == 0 && pastryCart.Count == 0) { Console.WriteLine(" *(Empty)"); } else { foreach (Bread bread in breadCart) { Console.WriteLine($" *({bread.Description})"); } int breadQuantity = ShoppingCart.GetBread().Count; int breadSubTotal = Bread.GetPrice(breadQuantity); Console.WriteLine($" [Bread subtotal: ${breadSubTotal.ToString()}]\n"); foreach (Pastry pastry in pastryCart) { Console.WriteLine($" *({pastry.Description})"); } int pastryQuantity = ShoppingCart.GetPastry().Count; int pastrySubTotal = Pastry.GetPrice(pastryQuantity); Console.WriteLine($" [Pastry subtotal: ${pastrySubTotal.ToString()}]"); } string grandTotal = ShoppingCart.GetTotal().ToString(); Console.WriteLine("----------------------"); Console.WriteLine($" [Grand Total: ${grandTotal}]"); Console.WriteLine("----------------------"); Console.WriteLine("\n(Type 'm' to see the menu, 'c' to clear the cart, and 'd' when done.)"); }