* @param i the item to add
* @throws WeightCapacityExceededException
*/
public void addToInventory(Item i, int n) throws WeightCapacityExceededException {
if((i.getWeight()*n) + totalWeight > capacity)
throw new WeightCapacityExceededException();
else{
for (int x=0; x<inventory.getLength(); x++){
if(inventory.getItemInventory()[x]!=null){
if(i.equals(inventory.getItemInventory()[x])){
totalWeight += (i.getWeight()*n);