Beispiel #1
0
        static void Main(string[] args)
        {
            var myBankAccount1 = new SavingsAccount("001", "Hawes");

            myBankAccount1.Deposit(500);
            Console.WriteLine(myBankAccount1.AccountHolderId + " has $" + myBankAccount1.Balance);

            var myBankAccount2 = new CurrentAccount("002", "Goh");

            myBankAccount2.Deposit(1500);
            Console.WriteLine(myBankAccount2.AccountHolderId + " has $" + myBankAccount2.Balance);
            myBankAccount2.Withdraw(115);
            Console.WriteLine(myBankAccount2.AccountHolderId + " now has $" + myBankAccount2.Balance);

            var myBankAccount3 = new OverDraftAccount("003", "Lee");

            myBankAccount3.Deposit(150);
            Console.WriteLine(myBankAccount3.AccountHolderId + " has $" + myBankAccount3.Balance);
            myBankAccount3.Withdraw(755);
            Console.WriteLine(myBankAccount3.AccountHolderId + " now has $" + myBankAccount3.Balance);


            var myBranch = new BankBranch("POSB-Bedok", "Tan Chuan-Jin");

            myBranch.PrintCustomers();
            myBranch.AddAccount(myBankAccount1);
            myBranch.AddAccount(myBankAccount2);
            myBranch.AddAccount(myBankAccount3);
            myBranch.PrintCustomers();
            Console.WriteLine("Total deposits: $" + myBranch.TotalDeposits());
            Console.WriteLine("Total interest paid: $" + myBranch.TotalInterestPaid());
            Console.WriteLine("Total interest earned: $" + myBranch.TotalInterestEarned());
        }
Beispiel #2
0
        public void InitializeSavingsAccount()
        {
            customer1 = new Customer("Tan Ah Kow", "123 ABC Road", "SXXXX199D", new DateTime(1991, 10, 31));
            customer2 = new Customer("Tan Ah Yow", "123 XYZ Road", "SXXXX123E", new DateTime(1993, 12, 02));
            customer3 = new Customer("Tan Ah Lao", "321 ABX Road", "SXXXX321F", new DateTime(1980, 3, 23));

            currentAccount   = new CurrentAccount("A10001", customer1, 1000);
            savingsAccount   = new SavingsAccount("A10002", customer2, 3000);
            overDraftAccount = new OverDraftAccount("A10003", customer3, -1000);

            bankBranch = new BankBranch("DBS Branch 1", "Tan Ah Seng");
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Account a2 = new SavingsAccount("Alamin", "3333", 30000);

            a2.transaction(1500);
            Console.WriteLine();
            a2.transaction(2000);
            a2.transaction(2000);
            a2.transaction(2000);
            a2.transaction(2000);
            a2.transaction(2000);

            a2.transaction(2000);
            a2.ShowInfo();
            Console.WriteLine();


            FixedAccount a4 = new FixedAccount("Rana ", "4444", 5555, 20000);

            a4.transaction(3000);
            a4.ShowInfo();
            Console.WriteLine();

            SpecialSavingsAccount a1 = new SpecialSavingsAccount("Ahamed", "6666", 2000);
            SpecialSavingsAccount a7 = new SpecialSavingsAccount("Ahamed", "7777", 1000);

            a1.transaction(300);
            a1.transaction(300);
            a1.transaction(300);
            a1.transaction(300);
            a1.transaction(300);
            a1.transaction(300);

            a7.transaction(500);
            a1.ShowInfo();
            a7.ShowInfo();
            Console.WriteLine();


            Account a3 = new OverDraftAccount("Ahamed ", "111", 10000);

            a3.transaction(5000);
            a3.ShowInfo();
            Console.WriteLine();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Account a2 = new SavingsAccount("Reza", "1122", 10000);

            a2.transaction(9580);
            Console.WriteLine();
            a2.transaction(1000);
            a2.transaction(1000);
            a2.transaction(1000);
            a2.transaction(1000);
            a2.transaction(1000);

            a2.transaction(1000);
            a2.ShowInfo();
            Console.WriteLine();


            FixedAccount a4 = new FixedAccount("DBL", "2123", 2020, 15000);

            a4.transaction(2000);
            a4.ShowInfo();
            Console.WriteLine();

            SpecialSavingsAccount a1 = new SpecialSavingsAccount("Sufian", "2000", 5000);
            SpecialSavingsAccount a7 = new SpecialSavingsAccount("Sufian", "2900", 300);

            a1.transaction(100);
            a1.transaction(100);
            a1.transaction(100);
            a1.transaction(100);
            a1.transaction(100);
            a1.transaction(100);

            a7.transaction(450);
            a1.ShowInfo();
            a7.ShowInfo();
            Console.WriteLine();


            Account a3 = new OverDraftAccount("MDBL2", "555", 5000);

            a3.transaction(5750);
            a3.ShowInfo();
            Console.WriteLine();
        }
        static void Main()
        {
            Customer         customerObj      = new Customer();
            SavingsAccount   savingsAccount   = new SavingsAccount();
            CurrentAccount   currentAccount   = new CurrentAccount();
            OverDraftAccount OverdraftAccount = new OverDraftAccount();

            Console.Write("Deposit 1000 dollars in Savings Account\n");
            System.Collections.ArrayList accountTypes = new System.Collections.ArrayList();
            accountTypes.Add(savingsAccount);
            accountTypes.Add(currentAccount);
            accountTypes.Add(OverdraftAccount);
            foreach (Object typ in accountTypes)
            {
                BankAccount baseObject = (BankAccount)typ;
                baseObject.DoAction((Int16)Action.Deposit);
                baseObject.DoAction((Int16)Action.CalculateInterest);
                //baseObject.DoAction((Int16)Action.CreditInterest);
            }

            Console.ReadKey();
        }
 public void InitializeSavingsAccount()
 {
     customer = new Customer("Tan Ah Kow", "123 ABC Road", "SXXXX199D", new DateTime(1991, 10, 31));
     account  = new OverDraftAccount("A10001", customer, 1000);
 }