Help with arrays?
The Bank class will have an array of Accounts. It's constructor will instantiate
the array and will populate it with 5 Account objects. The account numbers
will be from 1 to 5, and the balances will all be $100. It will also have
a method called doTransactions, which will require an array of Transactions
as a parameter. This method will step through the array and process each
transaction by calling the appropriate method in the appropriate Account
object. If a doWithdrawal call returns a false, it will write to System.out
"Insufficient funds for a withdrawal of " and the amount that was attempted
to be withdrawn (properly formatted in dollars and cents, of course). In
any case, it will send to System.out the transaction's toString result and
the affected account's toString (the account toString AFTER the processing).
The Project5 class will instantiate a Bank object and an array of 10 Transaction
objects. It will populate the array with Transactions by randomly generating
an integer from 1 to 5 for the account number, randomly generating an integer
from 1 to 2 for the transaction type, and randomly generating a double from
1 to 200 for the amount, generating new values for each Transaction object.
It will then call the doTransactions method of the Bank object and end.
Part of the project asks for arrays and I still don't understand them. Any
help would be thanked.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL