//BankAccountTester.java source code /** * A class to test the BankAccount class. * @author The ITEC120 class in unison */ public class BankAccountTester { /** Tests the methods of the BankAccount class. * @param args not used */ public static void main(String[] args) { BankAccount b; b = new BankAccount(); System.out.println( "b's balance is " + b.getBalance() + "; expected 0.0." ); // Check `deposit`: b.deposit(4.56); System.out.println( "b's balance is " + b.getBalance() + "; expected 4.56." ); b.deposit(0); System.out.println( "b's balance is " + b.getBalance() + "; expected 4.56." ); b.deposit(1); System.out.println( "b's balance is " + b.getBalance() + "; expected 5.56." ); // Test `withdraw`: b.withdraw(0); System.out.println( "b's balance is " + b.getBalance() + "; expected 5.56." ); b.withdraw(2.01); System.out.println( "b's balance is " + b.getBalance() + "; expected 3.55." ); // What happens if we overdraw? b.withdraw(10.55); System.out.println( "b's balance is " + b.getBalance() + "; expected -7." ); // Check that deposit/withdraw with a negative balance works okay: b.deposit(5); System.out.println( "b's balance is " + b.getBalance() + "; expected -2." ); b.withdraw(1); System.out.println( "b's balance is " + b.getBalance() + "; expected -3." ); } }