Example #1
0
        static void Main(string[] args)
        {
            Account a1 = new CurrentAccount("Shethil", "001", 50000);
            Account a2 = new SavingsAccount("Shethil", "002", 50000);
            Account a3 = new FixedAccount("Shethil", "003", 50000, 9, 2017);

            /* a1.ShowInfo();
             * a2.ShowInfo();
             * a3.ShowInfo();
             *
             * a1.Withdraw(50000);
             * a2.Withdraw(50000);
             * a3.Withdraw(50000);
             *
             * a1.Transfer(a2, 10000);
             *
             * a1.ShowInfo();
             * a2.ShowInfo();
             *
             * Customer c = new Customer();
             * c.AddAccount(a1, a2, a3);
             * var acc = c.GetAccount("001");
             * acc.Withdraw(49600);
             * c.ShowAccDetails(); */


            a1.Withdraw(5000);
            a1.Deposit(1000);
            a1.ShowAllTransaction();
            a1.ShowInfo();

            a2.Transfer(a1, 10000);
            a2.ShowAllTransaction();
            a2.ShowInfo();
        }
        static void Main(string[] args)
        {
            /*CurrentAccount a1 = new CurrentAccount("Mushfiqur Abir","12345",20000);
             * CurrentAccount a2 = new CurrentAccount("Mahabubur Sabir","67890",10000);
             * a1.ShowInfo();
             * a2.ShowInfo();
             * Console.WriteLine("************************");
             * a1.Withdraw(5000);
             * a1.Transfer(a2, 5000);
             * Console.WriteLine("************************");
             * a1.ShowInfo();
             * a2.ShowInfo();*/

            Account a1 = new SavingsAccount("ABIR", "12345", 50000);
            Account a2 = new CurrentAccount("ABIR", "67890", 50000);
            Account a3 = new SavingsAccount("ABIR SABIR", "112233", 5000);
            Account a4 = new FixedAccount("ABIR", "99999", 100000, 5, 2015);

            /*a1.Withdraw(49600);
             * a2.Withdraw(49600);
             * a1.ShowInfo();
             * a2.ShowInfo();*/

            Customer c = new Customer();

            c.AddAccounts(a1, a2, a3, a4);
            //c.ShowAccDetails();
            var acc = c.GetAccount("112233");

            acc.Withdraw(4600);
        }
Example #3
0
        static void Main(string[] args)
        {
            Account a2 = new CurrentAccount("Zubair Ahmed", "146", 50000);

            a2.Withdraw(49600);
            a2.SpecialSavings(500);
            a2.OverDraft(1000);
        }
Example #4
0
        public static void Main(string[] args)
        {
            var savingsAccount = new SavingsAccount("james", "obi", 22222222, 12322m);

            var currentAccount = new  CurrentAccount("kalu", "ezei", 22222222, 433322m);

            //savingsAccount.Debit ();
            //savingsAccount.credit ();

            Account[] account = new Account[2] {
                savingsAccount,
                currentAccount
            };
            Console.WriteLine(" Enter your Account Number");
            string accountNumber = Console.ReadLine();

            Console.WriteLine(" press 1 for current account or press 2 for savings account");
            int typeOfAccount = Convert.ToInt32(Console.ReadLine());

            if (typeOfAccount == 1)
            {
                Console.WriteLine(" Press 1 for deposit or 2 for withdrawal");
                int typeOfTransaction = Convert.ToInt32(Console.ReadLine());

                if (typeOfTransaction == 1)
                {
                    account [1].Debit();
                }
                else if (typeOfTransaction == 2)
                {
                    account [1].credit();
                }
                else
                {
                    throw new ArgumentOutOfRangeException("Value out of range");
                }
            }


            if (typeOfAccount == 2)
            {
                Console.WriteLine(" Press 1 for deposit or 2 for withdrawal");
                int typeOfTransaction = Convert.ToInt32(Console.ReadLine());

                if (typeOfTransaction == 1)
                {
                    account [0].Debit();
                }
                else if (typeOfTransaction == 2)
                {
                    account [0].credit();
                }
                else
                {
                    throw new ArgumentOutOfRangeException("Value out of range");
                }
            }
        }
Example #5
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            var dao = new BankDAO();
            var currentAccount = new CurrentAccount(dao, null);

            var limit = currentAccount.GetWithdrawalLimt(1);

            Console.WriteLine(limit);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            CurrentAccount current1 = new CurrentAccount("yomi", 23345, "gtb", 1000M);

            Console.WriteLine($"{current1.Balance:C}");
            current1.Credit(200m);
            Console.WriteLine($"{current1.Balance:C}");
            //   Console.WriteLine(current1);


            SavingsAccount savings1 = new SavingsAccount("james stayrt", 0292020, "Uba", 500m, 0.02m);

            Console.WriteLine($"{savings1.Balance:C}");
            decimal intrest1 = savings1.CalculateInterest();

            savings1.Credit(intrest1);
            Console.WriteLine($"{savings1.Balance:C}");
            // Console.WriteLine(savings1);

            SavingsAccount savings2 = new SavingsAccount("Kenny Show", 5677, "Union Bank", 500m, 0.03m);

            Console.WriteLine($"{savings2.Balance:C}");
            decimal intrest2 = savings2.CalculateInterest();

            savings2.Credit(intrest2);
            Console.WriteLine($"{savings2.Balance:C}");

            List <Account> accounts = new List <Account> {
                current1, savings1, savings2
            };

            Console.WriteLine("==============Looping through Accounts polymorphically============= ");


            foreach (var account in accounts)
            {
                if (account is SavingsAccount)
                {
                    var     savings     = (SavingsAccount)account;
                    decimal intrestRate = savings.CalculateInterest();
                    savings.Credit(intrestRate);
                    Console.WriteLine($"Intrest Added To Savings Account: {intrestRate:C}");
                }

                Console.WriteLine($"Account Balance {account.Balance:C}");
            }
        }
Example #7
0
        static void Main(string[] args)
        {
            /*a1.ShowInfo();
            *  a2.ShowInfo();
            *  a1.Withdraw(500);
            *  a1.Transfer(a2, 10000);
            *  Console.WriteLine("*********************");
            *  a1.ShowInfo();
            *  a2.ShowInfo();*/

            Account a1 = new SavingsAccount("Sreejan Roy", "19397371", 50000);
            Account a2 = new CurrentAccount("Sreejan Roy", "19397372", 50000);
            Account a3 = new SavingsAccount("Sreejan Roy", "19397373", 5000);
            Account a4 = new FixedAccount("Roy Sreejan", "19397374", 100000, 5, 2014);

            Customer c = new Customer();

            c.AddAccount(a1, a2, a3, a4);
            var acc = c.GetAccount("19397371");

            acc.Withdraw(49600);
            //c.ShowAccDetails();
        }
Example #8
0
        static void Main(string[] args)
        {
            /*a1.ShowInfo();
            *  a2.ShowInfo();
            *  a1.Withdraw(500);
            *  a1.Transfer(a2, 10000);
            *  Console.WriteLine("*********************");
            *  a1.ShowInfo();
            *  a2.ShowInfo();*/

            Account a1 = new SavingsAccount("Tanvir Ahmed", "145", 50000);
            Account a2 = new CurrentAccount("Tanvir Ahmed", "146", 50000);
            Account a3 = new SavingsAccount("Tanvir Ahmed Sabbir Ahmed", "147", 5000);
            Account a4 = new FixedAccount("Tanvir Ahmed", "148", 100000, 5, 2014);

            Customer c = new Customer();

            c.AddAccount(a1, a2, a3, a4);
            var acc = c.GetAccount("146");

            acc.Withdraw(49600);
            //c.ShowAccDetails();
        }
Example #9
0
        static void Main(string[] args)
        {
            SavingsAccount account1 = new SavingsAccount("James Stuart", "0027476177", 40000m, 0.03);

            CurrentAccount account2 = new CurrentAccount("Abayomi Igwubor", "0027476177", 30000m);

            List <Account> accounts = new List <Account>()
            {
                account1, account2
            };

            Console.Write("Welcome to Access Bank PLC!\nEnter type of transaction (Debit or Credit): ");
            string TransactionType = Console.ReadLine();

            Console.Write("Enter amount: ");
            decimal Amount = Convert.ToDecimal(Console.ReadLine());

            foreach (var account in accounts)
            {
                if (TransactionType.ToUpper() == "CREDIT")
                {
                    if (account is SavingsAccount)
                    {
                        SavingsAccount savings = account as SavingsAccount;
                        savings.CalculateInterest();
                    }
                    account.Credit(Amount);
                    Console.WriteLine(account);
                }
                else if (TransactionType.ToUpper() == "DEBIT")
                {
                    account.Debit(Amount);
                    Console.WriteLine(account);
                }
                Console.WriteLine("=========================\n");
            }
        }
 public void Setup()
 {
     dao = new Mock<IBankDAO>();
     _logger = new Mock<ILogger>();
     _currentAccount = new CurrentAccount(dao.Object, _logger.Object);
 }