Complete the code below according to the instructions below and the example test: method withdraw throws an exception if amount is greater than balance. For example: Test Result Account account = new...



Complete the code below according to the instructions below and the example test:




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


For example:





















TestResult

Account account = new Account("Acct-001","Juan dela Cruz", 5000.0); account.withdraw(5500.0);


System.out.println("Balance: "+account.getBalance());



Insufficient: Insufficient funds.


Balance: 5000.0



Account account = new Account("Acct-001","Juan dela Cruz", 5000.0); account.withdraw(500.0);


System.out.println("Balance: "+account.getBalance());


Balance: 4500.0



Incomplete java code:


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



Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here