// A simple application to show how to use the Account class // // // AccountTest2 ----uses----> Account // import java.io.*; import java.text.*; public class AccountTest2 { // variables for instances of Account class static Account george; static Account ringo; public static void main (String[] args) { double interest; // set up number format NumberFormat nf = NumberFormat.getCurrencyInstance(); // create new instances of the Account class george = new Account ("George", 5000. ); ringo = new Account ("Ringo", 10000. ); System.out.println("George's Bank Account Balance" + " Ringo's Bank Account Balance"); // call an Account method on the the two instances and print System.out.println("Initial balance is " + nf.format (george.getbalance()) + " Initial balance is " + nf.format (ringo.getbalance())); // more Account methods george.deposit(1500.); System.out.println("Deposits $1500. " + nf.format (george.getbalance())); ringo.deposit(823.); System.out.println(" " + "Deposits $823. " + nf.format (ringo.getbalance())); george.withdraw(523.); System.out.println("Attempt to withdraw $523. " + nf.format (george.getbalance())); interest = george.monthactivity(); System.out.print("After one month, interest " + nf.format (interest)); interest = ringo.monthactivity(); System.out.println(" " + nf.format (interest)); System.out.println("End of the month " + nf.format (george.getbalance()) + " " + nf.format (ringo.getbalance())); } }