Package exceptions

Examples of exceptions.InsufficientFundsException


    World.getWagon().getInventory().getWater().setNumber(200);
    World.getWagon().getInventory().getFood().setNumber(World.getWagon().getInventory().getFood().getNumber()+10);

    Leader leader = World.getWagon().getLeader();
    if(leader.getMoney() < getCost())
      throw new InsufficientFundsException();
    else
    {
      leader.setMoney(leader.getMoney()-getCost());
      World.getWagon().setNotification("You spent some money to cross safely.");
      //System.out.println("FERRY RESULT");
View Full Code Here


   * @return the Leader's current funds.
   * @throws InsufficientFundsException
   */
  public int addMoney(int change) throws InsufficientFundsException {
    if(money + change < 0)
      throw new InsufficientFundsException();
    else
      money += change;
    return money;
  }
View Full Code Here

   * @return
   * @throws InsufficientFundsException
   */
  public int setMoney(int newmoney) throws InsufficientFundsException {
    if(newmoney < 0)
      throw new InsufficientFundsException();
    else
      money = newmoney;
    return money;
  }
View Full Code Here

      try{
        World.getWagon().getLeader().setMoney((availCash-total));
        World.getWagon().addToInventory(i, buyNum);
      }
      catch(InsufficientFundsException f){
        throw new InsufficientFundsException();
      }
    } else {
      throw new WeightCapacityExceededException();
    }
  }
View Full Code Here

      try{
        World.getWagon().getLeader().setMoney((availCash-total));
        World.getWagon().addToInventory(i, buyNum);
      }
      catch(InsufficientFundsException f){
        throw new InsufficientFundsException();
      }
    } else {
      throw new WeightCapacityExceededException();
    }
  }
View Full Code Here

TOP

Related Classes of exceptions.InsufficientFundsException

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.