public void BuyItem(string itemName) { double price = 0; Console.WriteLine($"Prices: ${Lemon.price} per lemon, ${Sugar.price} per sugar, ${Ice.price} per ice, ${Cup.price} per cup."); string prompt = $"How many items would you like to purchase? Please enter a number greater than or equal to 0."; int numberOfItems = UserInterface.GetUserPositiveNumber(prompt); List <Item> items = new List <Item>(); for (int i = 0; i < numberOfItems; ++i) { switch (itemName) { case "lemon": price = Lemon.price; items.Add(new Lemon()); break; case "sugar": price = Sugar.price; items.Add(new Sugar()); break; case "ice": price = Ice.price; items.Add(new Ice()); break; case "cup": price = Cup.price; items.Add(new Cup()); break; } } if (price * numberOfItems > Money) { Console.WriteLine($"You do not have enough money to buy {numberOfItems} {itemName}. It costs ${price * numberOfItems} and you have ${Money}."); } else { Money -= price * numberOfItems; Console.WriteLine($"You have ${Money} after your purchase."); Inventory.AddItems(items); } DecideIfBuyingItems(); }