method withdraw throws an exception if amount is greater than balance. For example: Result - new Account ("Acct-001", "Juan dela Cruz", 5000.0); Insufficient: Insufficient funds. 5500.0); Balance:...



Subject: Object Oriented Prgramming


Language: Java Program
Topic: Exception




Method withdraw throws an exception if amount is greater than balance.



public class Account{
    private String accntNumber;
    private String accntName;
    private double balance;

    public Account(){}
    public Account(String num, String name, double bal){
        accntNumber = num;
        accntName = name;
        balance = bal;
    }

    public double getBalance(){ return balance;}
}
//your class here


method withdraw throws an exception if amount is greater than balance.<br>For example:<br>Result<br>- new Account (

Extracted text: method withdraw throws an exception if amount is greater than balance. For example: Result - new Account ("Acct-001", "Juan dela Cruz", 5000.0); Insufficient: Insufficient funds. 5500.0); Balance: 5000.0 n ("Balance: "+account. getBalance ()); - new Account ("Acct-001", "Juan dela Cruz", 5000.0); Balance: 4500.0 500.0); .n ("Balance: "+account.getBalance () );
method withdraw throws an exception if amount is greater than balance.<br>For example:<br>Test<br>Result<br>Account account = new Account (

Extracted text: method withdraw throws an exception if amount is greater than balance. For example: Test Result Account account = new Account ("Acct-001", "Juan dela Cruz", 5000.0); Insufficient: In: account.withdraw (5500.0); Balance: 5000.0 System.out.println ("Balance: "+account.getBalance () ); Account account = new Account ("Acct-001", "Juan dela Cruz", 5000.0); Balance: 4500.0 account.withdraw (500.0) ; System.out.println ("Balance: "+account.getBalance () );

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here