public Special createSpecialWithItem(String name, MenuItem item, double price) throws PizzaException { Special temp = new Special(name.trim()); if ((name.trim().equals("")) || (name == null) || (item == null) || (price < 0) || ((Double) price == null)) { throw new PizzaException( "Incorrect parameter createSpecialWithItem(<" + name.trim() + ">:String, <" + item.getName() + ">:MenuItem, <" + price + ">:double)"); } else { // if special exists in system already, find it, replace the name if (parentSystem.getPizzaStore().checkSpecialsForItem(item)) { temp = parentSystem.getPizzaStore().findSpecialByItem(item); temp.setSpecialName(name); temp.setSpecialPrice(price); } else { temp.addItemToSpecial(item, price); parentSystem.getPizzaStore().getSpecials().add(temp); } } return temp; }
public void modifySpecialPrice(Special special, double price) throws PizzaException { if (!(parentSystem.getPizzaStore().getSpecials().contains(special)) || (special == null) || (special.getItem() == null) || (price < 0) || (Double) price == null) { throw new PizzaException( "Incorrect parameter removeItemFromSpecial(<" + special.getSpecialName() + ">:Special)"); } else { special.setSpecialPrice(price); } }