Methods Summary |
---|
public void | addBeans(int added) beans += added;
|
public void | addCheese(int added)
// Add to the inventory
cheese += added;
|
public void | addChicken(int added) chicken += added;
|
public void | addRice(int added) rice += added;
|
public static BurritoInventory | getInstance()
// Make the static instance publicly available
return instance;
|
public synchronized boolean | makeBurrito()
// Burritos require one serving of each item
if (cheese > 0 && rice > 0 && beans > 0 && chicken > 0) {
cheese--; rice--; beans--; chicken--;
return true; // can make the burrito
}
else {
// Could order more ingredients
return false; // cannot make the burrito
}
|