//******************************************************************** // Account.java Author: Sophie Quigley // // Account class describes bank accounts // //******************************************************************** public class Account6 { private static int nextaccount = 1; public int accountID; private int balance; private Customer6 customer; public Account6 (Customer6 newcustomer) { customer = newcustomer; accountID = nextaccount; nextaccount++; balance = 0; } public void WhoAmI () { System.out.println("Account="+accountID+"; Balance="+balance+"; Belonging to customer:"); customer.WhoAmI(); } public void Deposit (int amount) { balance = balance + amount; } public boolean Withdraw (int amount) { if (amount <= balance || customer.Rating() == Customer6.EXCELLENT_CREDIT) { balance = balance - amount; return true; } else { System.out.println("Sorry you have unsufficient funds to cover withdrawal."); return false; } } public int Balance () { return balance; } }