Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Reading it in could be done as you suggest, with nested loops. It depends on how extensible this needs to be, if you're certain that the format of the data will never change, you don't need to make a flexible system. </p> <p>For storing the data, my impression is that you'd want a database, but assuming you want to store it in objects in memory, here's one way you could do it. </p> <p>You could give the customers, accounts and transactions all an ID number, and store them in Dictionaries. Then you could give the Customer account a list of ID numbers of its accounts, and likewise give the account a list of its transactions. This way the Account and Transaction data itself wouldn't be nested inside the Customers. There are other ways to do it, this is one way.</p> <p>For example:</p> <pre><code>// Not global variables, you'd have to put them in a class somewhere Dictionary&lt;int,Customer&gt; Customers; Dictionary&lt;int,Account&gt; Accounts; class Customer { List&lt;int&gt; MyAccounts; } </code></pre> <p>To access an account then if you have the ID, you can use Accounts[id]; For example:</p> <pre><code>foreach(int id in MyAccounts) { var account = Accounts[id]; // Do whatever with the account here } </code></pre> <p>Hopefully this is helpful, if I'm missing the point in some way do let me know. Since you refer to ArrayLists and getters/setters I assume you have a Java background. The List here is like an ArrayList. Getters/setters are done in the form of "Properties" in C#. The Dictionary is like a Map in Java.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload