private void orderFood() { if (menu.getChoice(choice).price < money) { log("I would like an order of " + choice + " please!"); customerGui.orderedFood(choice); log(choice + " please!"); waiter.msgHereIsMyChoice(this, choice); } else { for (int i = 0; i < menu.getMenuSize(); i++) { // Try to find a choice the customer can afford if (menu.getChoice(i).price < money) { choice = menu.getChoice(i).type; log("I would like an order of " + choice + " please!"); customerGui.orderedFood(choice); log(choice + " please!"); waiter.msgHereIsMyChoice(this, choice); return; } } if (name.equals("flake")) { // This customer will buy food he/she can't afford log("I would like an order of " + choice + " please!"); customerGui.orderedFood(choice); log(choice + " please!"); waiter.msgHereIsMyChoice(this, choice); } else { log("Everything is too expensive, I'm going to leave."); customerGui.doneEating(); waiter.msgImFinished(this); event = AgentEvent.leaving; } } }
public void msgRemoveFromMenu(String choice) { menu.removeChoice(choice); }