// A simple application to show how to use the AccountCmp class // // // AccountTest1 ----uses----> Account // | subclass // AccountCmpTest1 ----uses----> AccountCmp // import java.text.NumberFormat; public class AccountCmpTest1 { static AccountCmp paul; // variable for instance of Account class public static void main(String[] args) { double interest; // set up number format NumberFormat nf = NumberFormat.getCurrencyInstance(); // create a new instance of the AccountCmp class paul = new AccountCmp ("Paul", 5000. ); System.out.println("Paul's Bank Account Balance"); System.out.println("Initial balance is " + nf.format (paul.getbalance())); // call an Account method on the instance paul paul.deposit(1500.); System.out.println("Deposits $1500. " + nf.format (paul.getbalance())); paul.withdraw(523.); System.out.println("Attempt to withdraw $523. " + nf.format (paul.getbalance())); interest = paul.monthactivity(); System.out.println("After one month, interest " + nf.format (interest)); System.out.println("End of the month " + nf.format (paul.getbalance())); } }