Beispiel #1
0
        /*This reads the size of the bank and then reads each of the accounts in turn
        and adds it to the hash table.*/
        public static HashBank Load(System.IO.TextReader textIn)
        {
            HashBank result = new HashBank();
            string countString = textIn.ReadLine();
            int count = int.Parse(countString);

            for (int i = 0; i < count; i++)
            {
                string className = textIn.ReadLine();
                IAccount account =
                    AccountFactory.MakeAccount(className, textIn);
                result.bankHashtable.Add(account.GetName(), account);
            }
            return result;
        }
Beispiel #2
0
 /*This is the Save method which would be added to our Hashtable based bank.
 It gets each account out of the hash table and saves it in the given stream.
 Should An account class be saving multiple accoun*/
 public void Save(System.IO.TextWriter textOut)
 {
     HashBank hashBank = new HashBank();
     textOut.WriteLine(HashBank.bankHashtable.Count);
     foreach (CustomerAccount account in HashBank.bankHashtable.Values)
     {
         account.Save(textOut);
     }
 }