import java.io.*; public class Banking { public static void main(String[] args) throws IOException { BufferedReader keyIn = new BufferedReader( new InputStreamReader(System.in),1); Customer john = new Customer("John Jones"); Customer pat = new Customer("Pat Smith"); System.out.print("Enter deposit for " + john.getName() + " "); john.deposit(Double.parseDouble(keyIn.readLine())); System.out.print("Enter deposit for " + pat.getName() + " "); pat.deposit(Double.parseDouble(keyIn.readLine())); System.out.println(john.getName() + " balance " + john.getBalance()); System.out.println(pat.getName() + " balance " + pat.getBalance()); System.out.print("Enter withdrawal for " + john.getName() + " "); john.withdrawal(Double.parseDouble(keyIn.readLine())); System.out.print("Enter withdrawal for " + pat.getName() + " "); pat.withdrawal(Double.parseDouble(keyIn.readLine())); System.out.println(john.getName() + " balance " + john.getBalance()); System.out.println(pat.getName() + " balance " + pat.getBalance()); }//main }//class ///////////////////////////////////// new file ///////////////////// public class Customer { private String name; private BankAccount account; public Customer(String aName) { account = new BankAccount(); setName(aName); } public void setName(String n) { name = n; } public String getName() { return name; } public double getBalance() { return account.getBalance(); } public void deposit(double amount) { account.deposit(amount); } public void withdrawal(double amount) { if (!account.withdrawal(amount)) { System.out.println(name + " does not have enough funds in account. " + "Balance is: " + account.getBalance()); } } }//class /////////////////////////// new file ///////////////////////////// public class BankAccount { private double balance; public BankAccount() { balance = 0.0; } public double getBalance() { return balance; } public void deposit(double amount) { balance = balance + amount; } public boolean withdrawal(double amount) { if (balance >= amount) { balance = balance - amount; return true; } else { return false; } } }//class