Package exceptions

Examples of exceptions.WeightCapacityExceededException


   * @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);
 
View Full Code Here


   * @throws WeightCapacityExceededException
   */
  public void addToInventory(List<Item> l) throws WeightCapacityExceededException {
    int weight = sumWeight(l);
    if(weight + totalWeight > capacity)
      throw new WeightCapacityExceededException();
    totalWeight += weight;
  //  inventory.addAll(l);//needs compatibility fix with Inventory.java
  }
View Full Code Here

      }
      catch(InsufficientFundsException f){
        throw new InsufficientFundsException();
      }
    } else {
      throw new WeightCapacityExceededException();
    }
  }
View Full Code Here

      }
      catch(InsufficientFundsException f){
        throw new InsufficientFundsException();
      }
    } else {
      throw new WeightCapacityExceededException();
    }
  }
View Full Code Here

TOP

Related Classes of exceptions.WeightCapacityExceededException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.