Пример #1
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();
        }
        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();
        }
Пример #3
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();
        }
Пример #4
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();
        }
Пример #5
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
        }
Пример #6
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();
        }