Ejemplo n.º 1
0
        public void PrintCustomers()
        {
            Console.WriteLine($" List of account holders' IDs: ");

            for (int i = 0; i < BankAccounts.Count; i++)
            {
                Workshop_05_1_BankAccount_Polymorphism bankAcct01 = BankAccounts[i];
                Console.WriteLine($" {bankAcct01.acctHolderId}");
            }
        }
Ejemplo n.º 2
0
        public void TotalDeposits()
        {
            double sum0 = 0;

            for (int j = 0; j < BankAccounts.Count; j++)
            {
                Workshop_05_1_BankAccount_Polymorphism bA = BankAccounts[j];
                sum0 += bA.depositAmt;
            }
            Console.WriteLine($"\n Sum of Deposits of all bank account: $ {sum0:0.00}");
        }
Ejemplo n.º 3
0
        public void TotalInterestEarned()
        {
            double sum01 = 0;

            for (int t = 0; t < BankAccounts.Count; t++)
            {
                Workshop_05_1_BankAccount_Polymorphism bA02 = BankAccounts[t];
                sum01 += bA02.interestPaid;
                // sum01 += BankAccounts[t].interestEarned;
                // interested earned from customers in the form of admin fee due to negative fund
            }
            Console.WriteLine($" Sum of interests earned from across all accounts : $ {-sum01:0.00} ");
        }
Ejemplo n.º 4
0
        public void TotalInterestPaid()
        {
            double sum = 0;

            for (int k = 0; k < BankAccounts.Count; k++)
            {
                Workshop_05_1_BankAccount_Polymorphism bA01 = BankAccounts[k];
                sum += bA01.interestEarned;
                // sum += BankAccounts[k].interestPaid;
                // interest paid by the bank to customers
            }
            Console.WriteLine($" Sum of interests paid out to all accounts: $ {sum:0.00}");
        }
Ejemplo n.º 5
0
 public void AddAccount(Workshop_05_1_BankAccount_Polymorphism bankAcct)
 {
     BankAccounts.Add(bankAcct);
 }
 public void TransferTo(double amt, Workshop_05_1_BankAccount_Polymorphism bankAccount)
 {
     this.balance        -= amt;
     bankAccount.balance += amt;
 }