TransferTest

TransferTest - /* / TransferTest.java / / Driver to test...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************* // TransferTest.java // // Driver to test transfer feature of Account class. //******************************************************* import java.util.Scanner; public class TransferTest { private static Scanner scan = new Scanner(System.in); public static void main(String[] args) { Account acct1 = new Account(100, "Joe", 1234); Account acct2 = new Account(100, "Mary", 5678); int response; //Print initial account summaries printSummaries(acct1, acct2); //Call method to print menu and get user's choice response = getChoice(); while (response != 3) { switch(response) { case 1: System.out.println("Enter amount to transfer"); //Use instance method //acct1.transfer(acct2, scan.nextDouble()); //Use static method Account.transfer(acct1, acct2, scan.nextDouble()); printBalances(acct1, acct2); break; case 2: System.out.println("Enter amount to transfer"); //Use instance method //acct2.transfer(acct1, scan.nextDouble()); //Use static method
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the 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.

Page1 / 2

TransferTest - /* / TransferTest.java / / Driver to test...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online