ManageAccounts

ManageAccounts - //withdraw $50 from Sally's account...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// **************************************************************** // ManageAccounts.java // // Use Account class to create and manage Sally and Joe's // bank accounts // **************************************************************** public class ManageAccounts { public static void main(String[] args) { Account acct1, acct2; //create account1 for Sally with $1000 acct1 = new Account(1000, "Sally", 1111); //create account2 for Joe with $500 acct2 = new Account(500, "Joe", 12345); //deposit $100 to Joe's account acct2.deposit(100); //print Joe's new balance (use getBalance()) System.out.println ("Joe's new balance is $" + acct2.getBalance());
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //withdraw $50 from Sally's account acct1.withdraw(50); //print Sally's new balance (use getBalance()) System.out.println ("Sally's new balance is $" + acct1.getBalance()); //charge fees to both accounts System.out.println ("Sally's balance after charging a fee is " + acct1.chargeFee()); System.out.println ("Joe's balance after charging a fee is " + acct2.chargeFee()); //change the name on Joe's account to Joseph acct2.changeName("Joseph"); //print summary for both accounts System.out.println(acct1); System.out.println(acct2); } }...
View Full Document

This note was uploaded on 03/22/2010 for the course CS 202 taught by Professor Fong during the Spring '10 term at SIU Carbondale.

Ask a homework question - tutors are online