private void reorderFood() { if (menu.getMenuSize() > 0) { 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 { // Customer leaves if everything is too expensive log("Everything is too expensive, I'm going to leave."); customerGui.doneEating(); waiter.msgImFinished(this); event = AgentEvent.leaving; } } else { log("There's nothing left for me to order! I'm leaving!"); customerGui.doneEating(); waiter.msgImFinished(this); event = AgentEvent.leaving; } }
private void GuiDoneEating() { customerGui.doneEating(); }