/********************************************************** This file: Finances.java Author: CS302 Section 5 Date: 10-1-03 **********************************************************/ /** * The Finances class makes some SavingsAccount objects and * tests the methods of the SavingsAccount class. */ class Finances { public static void main(String[] args) { // Make an account for Mom, with interest rate 0.65% and $5000. SavingsAccount moms = new SavingsAccount(0.65, 5000); // Make an empty account for Junior, with interest rate 0.75%. SavingsAccount juniors = new SavingsAccount(0.75); // Have Junior deposit $14.56. juniors.deposit(14.56); // Have Mom transfer $150 to Junior. moms.transferFundsTo(juniors, 150); // Have Junior withdraw $20. juniors.withdraw(20); // Have Mom withdraw $34.29. moms.withdraw(34.29); // Do the end-of-month updates for both accounts. juniors.endOfMonth(); moms.endOfMonth(); // Print the balances and the transaction fee to 2 decimal places. DecimalFormat fmt = new DecimalFormat("0.00"); System.out.println("Mom's balance: " + fmt.format(moms.getBalance()); System.out.println("Junior's balance: " + fmt.format(juniors.getBalance()); System.out.println("Transaction fee: " + fmt.format(SavingsAccount.TRANS_FEE)); } }