import cs1.Keyboard; /** Simulate a bank accout. @author Greg Vogl last modified 2003-09-30 */ public class BankAccount1Test { /** Test the BankAccount class. */ public static void main (String[] args) { // get input System.out.println("This program simulates a bank account."); System.out.println("Enter an initial deposit in Uganda shillings and press Enter."); int amount = Keyboard.readInt(); // create a bank account BankAccount1 account = new BankAccount1(amount); // loop to get deposits and withdrawals; quit if deposit is 0 do { System.out.println("Enter a deposit, negative to withdraw, or 0 to quit."); amount = Keyboard.readInt(); if (amount > 0) account.deposit(amount); else if (amount < 0) account.withdraw(-amount); System.out.println("The balance is " + account.getBalance()); } while (amount != 0); } }