/* * @topic T00725 Banking exception demo * @brief Account class */ package banking; import java.lang.Math; public class Account { double balance; public Account( double balance ) { this.balance = balance; } public double getBalance() { return balance; } public long withdraw(double amt) throws OverdrawException { if ( amt > balance ) { throw new OverdrawException("Overdraw", amt - balance); } balance -= amt; return Double.doubleToLongBits( Math.random() ); }//withdraw }//Account class