Esato Mobile
General discussions : Non mobile discussion : Having JAVA BlueJ Problems
> New Topic
> Reply
< Esato Forum Index > General discussions > Non mobile discussion > Having JAVA BlueJ Problems Bookmark topic
presto Posts: 59

Quote:/**
* 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
}

}

Hi all. It's basically my first time i'm working on Java and I am already stuck! I have to implement methods & decide on an appropriate type of collection from the java.util package in, which individual bank accounts will be stored. I also have to declare a field to refer my collection.
I also have to create a field to keep track of the next available account number.

So far I know that all field in the classes should be Private and any method I add to the Bank class must also be private.

I've created my other classes so there fine, it's just this i'm stuck on.
Thanks in advance and don't worry it isn't a piece of coursework so i'm not cheating or anything ridiculous like that because at the end of the day I won't learn anything!
It's a project my cousin has sent me from his previous year at uni. I'm still at college and want to do Computer Science so I want to learn before I do it next year if you know what I mean.

Thank you again.
--
Posted: 2006-11-27 15:08:59
Edit : Quote

New Topic   Reply
Forum Index

Esato home