static void Main(string[] args)
        {
            //Object initialization, enkel bij public setters. voor interactie tussen views en models
            //BankAccount anotherBa = new BankAccount()
            //{
            //    AccountNumber = "123-12312312-99",
            //    Balance = 200
            //};

            var myBA = new BankAccount("123-12312312-99", 50); // var want compiler kan zelf afleiden welk type myBA is

            Console.WriteLine($"Accountnumber is {myBA.AccountNumber}");
            Console.WriteLine(myBA);
            myBA.Deposit(200);
            Console.WriteLine(myBA);
            myBA.Withdraw(50);
            Console.WriteLine(myBA);

            foreach (var item in myBA.Transactions)
            {
                Console.WriteLine($"{item.Amount} -- {item.DateOfTransaction} -- {item.TransactionType}");
            }

            BankAccount mySA = new SavingsAccount("123-12312312-67", 0.01M);

            mySA.Deposit(1000);
            ((SavingsAccount)mySA).addInterest();
            mySA.Withdraw(10);
            Console.WriteLine($"Balance of savingsAccount: {mySA.Balance}");
            foreach (var item in mySA.Transactions)
            {
                Console.WriteLine($"{item.Amount} -- {item.DateOfTransaction} -- {item.TransactionType}");
            }
            Console.ReadKey();
        }
Exemple #2
0
        static void Main()
        {
            BankAccount myAccount = new BankAccount("123-123123-12");

            Console.WriteLine($"Account number: {myAccount.AccountNumber}");
            Console.WriteLine($"Account balance: {myAccount.Balance}");
            myAccount.Deposit(200M);
            Console.WriteLine($"Account balance after deposit of 200€: {myAccount.Balance}");
            Console.WriteLine($"Number of transactions after deposit: {myAccount.NumberOfTransactions}");
            myAccount.Withdraw(100M);
            Console.WriteLine($"Account balance after withdrawal of 100€: {myAccount.Balance}");
            Console.WriteLine($"Number of transactions after withdrawal: {myAccount.NumberOfTransactions}");
            int aantal = myAccount.GetTransactions(DateTime.Today.AddDays(-2), DateTime.Today).Count();

            Console.WriteLine($"Aantal transacies: {aantal}");

            SavingsAccount saving = new SavingsAccount("123-123123-12", 0.01M);

            saving.Deposit(200M);
            saving.Withdraw(100M);
            saving.AddInterest();
            Console.WriteLine($"Balance savingsaccount: {saving.Balance}");
            Console.Write(saving);

            Console.Read();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            BankAccount myBA = new BankAccount("123-12312312-999", 50);

            Console.WriteLine($"Accountnummer is  {myBA.AccountNumber}");
            Console.WriteLine($"Balance is {myBA.Balance} Euro");
            myBA.Deposit(200);
            Console.WriteLine($"Balance is {myBA.Balance} Euro");
            myBA.Withdraw(50);
            Console.WriteLine($"Balance is {myBA.Balance} Euro");

            foreach (var item in myBA.Transactions)
            {
                Console.WriteLine($"{item.Amount} -- {item.DateOfTransaction} -- {item.TransactionType}");
            }

            SavingsAccount mySA = new SavingsAccount("123-12312312-67", 0.01M);

            mySA.Deposit(1000);
            mySA.addIntrest();
            mySA.Withdraw(10);
            Console.WriteLine($"Balance of savingsAccount is: {mySA.Balance}");

            foreach (var item in myBA.Transactions)
            {
                Console.WriteLine($"{item.Amount} -- {item.DateOfTransaction} -- {item.TransactionType}");
            }

            Console.ReadKey();
        }
Exemple #4
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());
        }
        static void Main(string[] args)
        {
            BankAccount account = new BankAccount("123-123123-12");

            Console.WriteLine($"AccountNumber:{account.AccountNumber}");
            Console.WriteLine($"Balance:{account.Balance}");
            account.Deposit(200M);
            Console.WriteLine($"Balance after deposit of 200 euro: {account.Balance}");
            Console.WriteLine($"Number of transactions after deposit of 200 euros: {account.NumberOfTransactions}");
            account.Withdraw(100M);
            Console.WriteLine($"Balance after withdraw 100 euros: {account.Balance}");
            Console.WriteLine($"Number of transactions after withdraw of 100 euro: {account.NumberOfTransactions}");
            int aantal = (account.GetTransactions(DateTime.Today.AddDays(-2), DateTime.Today)).Count();

            Console.WriteLine($"Aantal transacties: {aantal}");

            SavingsAccount saving = new SavingsAccount("123-456789-03", 0.01M);

            Console.WriteLine($"SavingsAccount: {saving}");
            saving.Deposit(200M);
            saving.Withdraw(100M);
            saving.AddInterest();
            Console.WriteLine($"Balance savingsaccount: {saving.Balance}");

            Console.ReadKey();
        }
Exemple #6
0
        static void Main(string[] args)
        {
            IBankAccount account = new BankAccount("123-4567890-02");

            Console.WriteLine($"AccountNumber: {account.AccountNumber} ");
            Console.WriteLine($"Balance: {account.Balance} ");
            account.Deposit(200M);
            Console.WriteLine($"Balance after deposit of 200 euros: {account.Balance} ");
            account.Withdraw(100);
            Console.WriteLine($"Balance after withdraw of 100 euros: {account.Balance} ");
            Console.WriteLine($"Number of transactions: {account.NumberOfTransactions}");
            IEnumerable <Transaction> transactions = account.GetTransactions(null, null);

            foreach (Transaction t in transactions)
            {
                Console.WriteLine($"Transaction: {t.DateOfTrans} - {t.Amount} - {t.TransactionType}");
            }

            IBankAccount savingsAccount = new SavingsAccount("123-4567890-02", 0.05M);

            Console.WriteLine($"SavingsAccount : {savingsAccount}");
            savingsAccount.Deposit(200M);
            savingsAccount.Withdraw(100M);
            Console.WriteLine($"Balance savingsaccount: {savingsAccount.Balance} ");
            (savingsAccount as SavingsAccount).AddInterest();
            Console.WriteLine($"Balance savingsaccount after interest: {savingsAccount.Balance} ");
            Console.WriteLine(savingsAccount); // implicit call to ToString()
        }
Exemple #7
0
        static void Main(string[] args)
        {
            BankAccount myAccount = new BankAccount("123-123123-12");

            Console.WriteLine($"AccountNumber: {myAccount.AccountNumber}");
            Console.WriteLine($"Balance: {myAccount.Balance}");
            myAccount.Deposit(200M, "My first deposit");
            Console.WriteLine($"Balance after deposit of 200 euros: {myAccount.Balance}");
            myAccount.Withdraw(100M);
            Console.WriteLine($"Balance after withdrawal of 100 euros: {myAccount.Balance}");
            Console.WriteLine($"Number of transactions: {myAccount.NumberOfTransactions}");
            IEnumerable <Transaction> transactions = myAccount.GetTransactions(null, null);

            foreach (Transaction t in transactions)
            {
                Console.WriteLine($"Transaction: {t.DateOfTrans} - {t.Amount} - {t.TransactionType} - {t.Notes ?? "No description"}");
            }
            SavingsAccount saving = new SavingsAccount("123-4567891-03", 0.01M);

            saving.Deposit(200M);
            saving.Withdraw(100M);
            saving.AddInterest();
            Console.WriteLine($"Balance savingsaccount: {saving.Balance}");
            BankAccount savingsAccount = new SavingsAccount("132-4567890-02", 0.05M);

            Console.WriteLine($"SavingsAccount : {savingsAccount}");
            savingsAccount.Deposit(200M);
            savingsAccount.Withdraw(100M);
            Console.WriteLine($"Balance savingsaccount: {savingsAccount.Balance}");
            Console.ReadKey();
        }
Exemple #8
0
        static void Main(string[] args)
        {
            BankAccount myBA = new BankAccount("123-12312312-99");

            Console.WriteLine($"Account {myBA.AccountNumber} created...");
            Console.WriteLine($"Balance is currently {myBA.Balance} Euro");
            //Console.WriteLine($"Withdrawcost is {BankAccount.WithdrawCost} Euro");


            BankAccount myOtherBA = new BankAccount("123-32112332-99", 50);

            //var myOtherBA = new BankAccount("123-32112332-99", 50); -> gaan vaak var gebruiken hiervoor

            Console.WriteLine($"Account {myOtherBA.AccountNumber} created...");
            Console.WriteLine($"Balance is currently {myOtherBA.Balance} Euro");

            myBA.Deposit(1000);
            Console.WriteLine(myBA);
            myBA.Deposit(200 /*, 3*/);
            Console.WriteLine(myBA);
            myBA.Withdraw(100);
            //toString wordt automatisch aangeroepen!
            Console.WriteLine(myBA);

            //IEnumerable<Transaction> transactions = myBA.Transactions;
            var transactions = myBA.Transactions;

            foreach (var item in transactions)
            {
                Console.WriteLine($"{item.DateOfTransaction} -- {item.Amount} -- {item.TransactionType}");
            }

            var mySA = new SavingsAccount("123-12312312-88", 0.01M);

            mySA.Deposit(1000);
            mySA.AddInterest();
            mySA.Withdraw(20);

            var transactions2 = mySA.Transactions;

            foreach (var item in transactions2)
            {
                Console.WriteLine($"{item.DateOfTransaction} -- {item.Amount} -- {item.TransactionType}");
            }

            Console.ReadKey();
        }
Exemple #9
0
        static void Main(string[] args)
        {
            //Object Initializer
            //BankAccount anotherBA = new BankAccount() {
            //    AccountNumber = "123-12312334-99",
            //    Balance = 200
            //};

            BankAccount myBA = new BankAccount("123-12312312-99", 50);

            //Console.WriteLine($"Account number is {myBA.AccountNumber}");
            Console.WriteLine(myBA);
            //Console.WriteLine($"Withdraw cost is {BankAccount.WithdrawCost} Euro");
            //Console.WriteLine($"Balance is {myBA.Balance} Euro.");
            Console.WriteLine(myBA);
            myBA.Deposit(200);
            //Console.WriteLine($"Balance is {myBA.Balance} Euro.");
            Console.WriteLine(myBA);
            myBA.Withdraw(50);
            //Console.WriteLine($"Balance is {myBA.Balance} Euro.");
            Console.WriteLine(myBA);

            //IEnumerable<Transaction> transactions = myBA.Transactions;
            //var transactions = myBA.Transactions;
            foreach (var item in myBA.Transactions)
            {
                Console.WriteLine($"{item.Amount} -- {item.DateOfTransaction} -- {item.TransactionType}");
            }

            var mySA = new SavingsAccount("123-12312312-67", 0.01M);

            mySA.Deposit(1000);
            mySA.AddInterest();
            mySA.Withdraw(10);
            Console.WriteLine($"Balance of savingsAccount: {mySA.Balance}.");

            foreach (var item in mySA.Transactions)
            {
                Console.WriteLine($"{item.Amount} -- {item.DateOfTransaction} -- {item.TransactionType}");
            }

            Console.ReadKey(); //Zodat console niet onmiddelijk afsluit
        }
Exemple #10
0
        static void Main(string[] args)
        {
            IBankAccount account = new BankAccount("123-4567890-12");

            Console.WriteLine($"Accountnumber - Balance: {account.ToString()}");
            //Console.WriteLine($"Balance: {account.Balance}");
            account.Deposit(200M);
            Console.WriteLine($"Balance after deposit of 200€: {account.Balance}");
            account.Withdraw(100M);
            Console.WriteLine($"Balance after withdraw of 100€: {account.Balance}");
            IEnumerable <Transaction> transactions = account.GetTransactions(null, null);

            foreach (Transaction t in transactions)
            {
                Console.WriteLine($"Transactions: {t.DateOfTrans.ToShortDateString()} - {t.Amount}");
            }
            SavingsAccount saving = new SavingsAccount("123-456789-03", 0.01M);

            saving.Deposit(200M);
            saving.Withdraw(100M);
            saving.AddInterest();
            Console.WriteLine($"Balance savingsaccount: {saving.ToString()}");
            Console.ReadKey();
        }
Exemple #11
0
 public override void Deposit(decimal amount)
 {
     CreateAccount();
     _realAccount.Deposit(amount);
 }
Exemple #12
0
        static void Main(string[] args)
        {
            int             balance;
            string          accountName;
            int             menuOption = 0;
            CheckingAccount checking   = null;
            SavingsAccount  savings    = null;


            while (menuOption != 1)
            {
                menuOption = GetNumber("1 - Exit\n2 - " +
                                       "Create Checking\n3 - Create Savings\n4 - " +
                                       "Check Checking Balane\n5 - Check Saving Balance\n6 -" +
                                       " Deposit To Checking\n7 - Deposit To Savings ");
                switch (menuOption)
                {
                case 1:
                    break;

                case 2:
                    accountName = GetInput("Account Name");
                    balance     = GetNumber("Initial Amt: ");
                    checking    = new CheckingAccount(accountName, balance, 0.02f);
                    break;

                case 3:
                    accountName = GetInput("Account Name");
                    balance     = GetNumber("Initial Amt: ");
                    savings     = new SavingsAccount(accountName, balance, 0.03f);
                    break;

                case 4:
                    Console.WriteLine("Your Checking Account currently is: " + checking);
                    break;

                case 5:
                    Console.WriteLine("Your Saving Account currently is:" + savings);
                    break;

                case 6:
                    accountName = GetInput("Account Name");
                    int CheckingDposit = Utils.GetNumber("How much will you be depositing?: ");
                    checking.Deposit(CheckingDposit);
                    Console.WriteLine(CheckingDposit + " Has been added");
                    break;

                case 7:
                    accountName = GetInput("Account Name");
                    int savingDeposit = Utils.GetNumber("How much will you be depositing?: ");
                    savings.Deposit(savingDeposit);
                    Console.WriteLine(savingDeposit + " Has been added");
                    break;



                default:
                    break;
                }
            }
        }