// BankSimple.java Copyright (c) 2005 Kari Laitinen // http://www.naturalprogramming.com // 2004-10-03 File created. // 2005-02-05 Last modification. /* In the javafiles3 folder, there are three .java files which contain a class named BankAccount. These files are BankSimple.java, BankBetter.java, and BankVirtuals.java. Because the BankAccount class is not the same class in BankSimple.java as in BankBetter.java and BankVirtuals.java, it is possible that you encounter problems when you compile and run these programs. Therefore, I would like to advise that, before you attempt to run any of the mentioned programs, you compile the program before running it. One possible problem that can occur is that program BankSimple.java cannot be run after BankBetter.java has been compiled. The reason for this is that the compilation of BankBetter.java (or BankVirtuals.java) replaces the BankAccount.class file produced by the compilation of BankSimple.java with a different BankAccount.class file. */ class BankAccount { String account_owner ; long account_number ; double account_balance ; public void initialize_account( String given_name, long given_account_number ) { account_owner = given_name ; account_number = given_account_number ; account_balance = 0 ; } public void show_account_data() { System.out.print( "\n\nB A N K A C C O U N T D A T A : " + "\n Account owner : " + account_owner + "\n Account number: " + account_number + "\n Current balance: " + account_balance ) ; } public void deposit_money( double amount_to_deposit ) { System.out.print( "\n\nTRANSACTION FOR ACCOUNT OF " + account_owner + " (Account number " + account_number + ")" ) ; System.out.print( "\n Amount deposited: " + amount_to_deposit + "\n Old account balance: " + account_balance ) ; account_balance = account_balance + amount_to_deposit ; System.out.print( " New balance: " + account_balance ) ; } } class BankSimple { public static void main( String[] not_in_use ) { BankAccount first_account = new BankAccount() ; BankAccount second_account = new BankAccount() ; first_account.initialize_account( "James Bond", 77007007 ) ; second_account.initialize_account( "Philip Marlowe", 22003004 ) ; first_account.deposit_money( 5566.77 ) ; second_account.deposit_money( 9988.77 ) ; first_account.deposit_money( 2222.11 ) ; first_account.show_account_data() ; second_account.show_account_data() ; } }