/**
* Banks.
* A bank is a collection of BankAccounts indexed by account numbers.
*
*/
public class Bank
{
// your fields go here
private string Bank;
/**
* Constructor for objects of class Bank.
* Newly created banks contain no accounts.
*/
public Bank()
{
// to be implemented
// initialise your fields here
}
/**
* Open a new bank account and return its account number.
* Account numbers are assigned to new accounts automatically:
* the first account created has account number "1", the second
* has account number "2", and so on.
*/
public String openNewAccount(String name, int initialBalance, int overdraftLimit)
{
// to be implemented
return ""; // replace this by something sensible
}
/**
* If the account exists and has a zero balance,
* remove it from the bank. If it does not exist, or
* does exist but has a non-zero balance, do nothing.
* Note that removing an account has NO effect on the
* account numbers of other accounts, or on the
* automatically allocated account numbers for new
* accounts.
*
* @param accountNumber the account number to remove
*/
public void closeAccount(String accountNumber)
{
// to be implemented
}
/**
* The bank account with the given account number, or null
* if no such account exists.
*
* @param accountNumber the account number
*/
public BankAccount getAccount(String accountNumber)
{
// to be implemented
return null; // replace this by something sensible
}
/**
* The value of the total debt of all overdrawn accounts.
* For example, when the bank contains four accounts, with balances
* of 99, -20, -230, 0 then this method returns 250.
*/
public int totalDebt()
{
// to be implemented
return -1; // replace this by something sensible
}
/**
* Print a list of the account numbers and account details
* for all accounts.
*/
public void printAccounts()
{
// not assessed
// but maybe useful for debugging purposes
}
/**
* The total number of accounts in this bank.
*/
public int size()
{
// to be implemented
return -1; // replace this by something sensible
}
} |