Example #1
0
        static void Main(string[] args)
        {
            var a = new Account("Putin", "1234", 12000);
            var b = new Account("Trump", "4321", 4000);

            a.Transfer(1000, b);
            a.showAllTransactions();
            b.showAllTransactions();
        }
        static void Main(string[] args)
        {
            Bank bank = new Bank();

            bank.BankName = "DBBL";
            Address ad1 = new Address("1/D", "498", "DHAKA", "BANGADESH");


            Account a1 = new Account("Sneha", 90000, ad1);

            bank.AddAccount(a1);

            Address ad2 = new Address("1/B", "48", "DHAKA", "BANGADESH");
            Account a2  = new Account("Durjoy", 50000, ad2);

            Address ad3 = new Address("1/A", "45", "JESSORE", "NEWYORK");
            Account a3  = new Account("Anik", 10000, ad3);

            bank.AddAccount(a2);



            bank.AddAccount(a3);


            Address ad4 = new Address("4", "149", "CUMILLA", "NOAKHALI");
            Account a4  = new Account("PRANTIKA", 6000, ad4);

            bank.AddAccount(a4);
            Console.WriteLine("After adding accounts: \n");
            bank.PrintAccountDetails();

            Console.WriteLine("---------------------------------------------");

            Console.WriteLine("After deposite to account 3: \n");

            a3.Deposite(6000);
            a3.ShowAccountInformation();
            Console.WriteLine("---------------------------------------------");
            a2.Transfer(a3, 500);
            Console.WriteLine("After transfer balance:");
            a2.ShowAccountInformation();
            a3.ShowAccountInformation();
            Console.WriteLine("---------------------------------------------");
            a1.Withdraw(500);
            Console.WriteLine("After withdraw method:");

            a1.ShowAccountInformation();
            Console.WriteLine("---------------------------------------------");
            Console.WriteLine("After deleting account 4: \n");
            bank.DeleteAccount(a4.AccountNumber);
            bank.PrintAccountDetails();
        }
Example #3
0
        private static void Transfer()
        {
            Console.WriteLine("Select the account id from which you want to withdraw: ");
            int selectIndexBase = ReadNumericEntry();

            Account account = accountList[selectIndexBase];


            Console.WriteLine("Select the account id from which you want to transfer: ");
            int selectIndexTransfer = ReadNumericEntry();

            Account destinyAccount = accountList[selectIndexTransfer];


            Console.WriteLine("Select the value to transfer: ");
            double selectValue = ReadDoubleEntry();

            account.Transfer(transferValue: selectValue, destinyAccount: destinyAccount);
        }
Example #4
0
        private static void InnerTest()
        {
            try
            {
                Account acc = new Account(338, 752669);
                acc.Balance = 100;
                acc.Withdraw(500);
                Account acc2 = new Account(338, 789966);
                acc.Transfer(-450, acc2);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            } //catch(ArgumentException e)
              //{

            //    Console.WriteLine("Erro de argumento " +e.Message + " argument: " + e.ParamName);
            //}
            //catch(InsufficientBalanceException ie)
            //{
            //    Console.WriteLine(ie.Message );
            //}
        }