TestAccount - System.out.println(acct System.out.println"\nEnter account number" acctNum = scan.nextLong acct = new

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

View Full Document Right Arrow Icon
//******************************************************* // TestAccount.java // // A simple driver to test the overloaded methods of // the Account class. //******************************************************* import java.util.Scanner; public class TestAccount { public static void main(String[] args) { String name; double balance; long acctNum; Account acct; Scanner scan = new Scanner(System.in); System.out.println("Enter account holder's first name"); name = scan.next(); acct = new Account(name); System.out.println("Account for " + name + ":"); System.out.println(acct); System.out.println("\nEnter initial balance"); balance = scan.nextDouble(); acct = new Account(balance,name); System.out.println("Account for " + name + ":");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.println(acct); System.out.println("\nEnter account number"); acctNum = scan.nextLong(); acct = new Account(balance,name,acctNum); System.out.println("Account for " + name + ":"); System.out.println(acct); System.out.print("\nDepositing 100 into account, balance is now "); acct.deposit(100); System.out.println(acct.getBalance()); System.out.print("\nWithdrawing $25, balance is now "); acct.withdraw(25); System.out.println(acct.getBalance()); System.out.print("\nWithdrawing $25 with $2 fee, balance is now "); acct.withdraw(25,2); System.out.println(acct.getBalance()); System.out.println("\nBye!"); } }...
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