/* * NegativeAmount.java * Created on August 16, 2002, 3:03 PM */ package bank; /** * * @author mike */ public class NotEnoughMoneyException extends java.lang.Exception { private double amount = 0; // amount account was short Account acctTakingFrom; // Account that was short /** * Creates a new instance of NegativeAmount without detail message. */ public NotEnoughMoneyException() { } /** * Constructs an instance of NegativeAmount with the specified detail message. * @param msg the detail message. */ public NotEnoughMoneyException(String msg) { super(msg); } /** * Constructs an instance of NegativeAmount with the specified detail message. * @param msg the detail message. */ public NotEnoughMoneyException(String msg, double amt) { super(msg); amount = amt; } /** * Constructs an instance of NegativeAmount with the specified detail message. * @param msg the detail message. */ public NotEnoughMoneyException(String msg, Account toTakeFrom, double amt) { super(msg); amount = amt; acctTakingFrom = toTakeFrom; } /** * To obtain the amount that an account was short */ public double getAmount () { return amount; } /** * To obtain the account that didn't have enough money */ public Account getAcctTakingFrom () { return acctTakingFrom; } }