This makes my brain hurt...
I'd like to add multiple variables such as date and time to an arraylist, and add that arraylist to another arraylist holding different variables such as name and age.
Example: An ArrayList holds multiple accounts. Each account has an id, name, balance and transaction history. Each transaction has an id, date, time and transaction amount.
So the accounts ArrayList would contain: (int | String | double | ArrayList)
,
and the transactions ArrayList would contain: (int | Date | Time | double)
.
I'd appreciate it if you could help me understand how to do this, or offer a better solution.
EDIT:
I can't really show all my code because I'm using a model view controller which accesses a model and 4 views. I can try to describe what it does though.
Click "Create Account" button:
- make a new account (using Account class)
- set accountID = length of accounts ArrayList
- set accountName = textbox input
- set accountBalance = 0
- create transactions ArrayList (using Transactions class)
- add all to the accounts ArrayList.
Click "Deposit" button:
- add TextBox input to accountBalance
- set transactionID = length of transactions ArrayList
- set transactionDate = current date
- set transactionTime = current time
- add all to selected account's transactions ArrayList