public void removeCD( String item) throws Exception { if(item == null) { throw (new Exception("null Value passed to removeItem!!!")); } boolean found = false; for(int index=0; index < CDList.size(); index++) { CartItem temp = (CartItem)CDList.elementAt(index); if( temp.getItemID().equals(item.getItemID() )) { found = true; total -= temp.getPrice() * temp.getQuantity(); CDList.removeElement(temp); } } if(!found) { throw (new Exception("Trying to remove a CD that does not exist in the CART!!!")); } }