public void setQuantity(String name, int num) { for (Food food : foods) { if (food.choice.equals(name)) { food.amount = num; } } }
public void msgHereIsOrder(String choice, int amount, int id) { print("Received a delivery of " + amount + " " + choice + "'s from the market!"); for (int i = 0; i < marketOrders.size(); i++) { MarketOrder mo = marketOrders.get(i); if (mo.id == id && mo.amount == amount) { Food f = findFood(mo.food); f.amount = amount; print("removing a market order whee"); marketOrders.remove(mo); } else if (mo.food == choice && mo.amount != 0) { Food f = findFood(mo.food); f.amount = amount + mo.amount; mo.amount -= amount; } } }