示例#1
0
        public static void Main()
        {
            Customer c1 = new Customer("Shamil", "Clementi", "G67347", new DateTime(1991, 03, 21));
            Customer c2 = new Customer("Raniah", "Clementi", "J76443", new DateTime(1993, 07, 09));
            Customer c3 = new Customer("Basim", "Clementi", "N47563", new DateTime(2006, 04, 25));


            //SavingsAccount s = new SavingsAccount("G74798934", c1, 400000);
            //s.Show();
            //Console.WriteLine(s.CalculateInterest());
            //s.CreditInterest();
            //s.Show();

            CurrentAccount c = new CurrentAccount("7345-4353-33", c2, 3500);

            c.Show();
            Console.WriteLine(c.CalculateInterest());
            c.CreditInterest();
            c.Show();

            //OverDraftAccount o = new OverDraftAccount("3434-34535-22", c3, -500);
            //o.Withdraw(500);
            //o.Show();
            //o.Show();
            //Console.WriteLine(o.CalculateInterest());
            //o.CreditInterest();
            //o.Show();


            Account sa = new SavingsAccount("567-2543-316236", c2, 1200);

            sa.Show();
            Console.WriteLine(sa.CalculateInterest());
            sa.CreditInterest();
            sa.Show();

            try
            {
                c.TransferTo(4000, sa);
            }
            catch (InsufficientFundsException e)
            {
                Console.WriteLine("IN MAIN " + e.Message);
            }
        }
示例#2
0
        public static void Main()
        {
            Customer c1 = new Customer("Shamil", "Clementi", "G67347", new DateTime(1991, 03, 21));
            Customer c2 = new Customer("Basim", "Clementi", "J76443", new DateTime(1993, 07, 09));
            Customer c3 = new Customer("Raniah", "Clementi", "N47563", new DateTime(2006, 04, 25));
            Customer c4 = new Customer("Ramla", "CLementi", "B64367", new DateTime(1966, 09, 01));
            Customer c5 = new Customer("Abdul Razak", "CLementi", "H54567", new DateTime(1956, 11, 01));


            SavingsAccount   sc1 = new SavingsAccount("G74798934", c1, 4000);
            CurrentAccount   cc2 = new CurrentAccount("7345-4353-33", c2, 3500);
            OverDraftAccount oc3 = new OverDraftAccount("3434-34535-22", c3, -500);
            OverDraftAccount oc4 = new OverDraftAccount("342-24525-245", c4, -1000);
            OverDraftAccount oc5 = new OverDraftAccount("3543-2352-5-253", c5, 6700);

            List <Account> banklist = new List <Account>();

            BankBranch bb = new BankBranch("Clementi", "Mr. John", banklist);



            bb.AddAccount(sc1);
            bb.AddAccount(cc2);
            bb.AddAccount(oc3);
            bb.AddAccount(oc4);
            bb.AddAccount(oc5);

            //Console.WriteLine(sc1.CalculateInterest());
            //Console.WriteLine(cc2.CalculateInterest());
            //Console.WriteLine(oc3.CalculateInterest());
            //Console.WriteLine(oc4.CalculateInterest());
            //Console.WriteLine(oc5.CalculateInterest());


            //Console.WriteLine(bb.TotalDeposits());
            bb.TotalInterestPaid();
            bb.TotalInterestEarned();

            bb.BAccounts[3].Withdraw(40);
            Console.WriteLine(bb.BAccounts[3].Balance);



            bb.PrintCustomers();
        }