Ejemplo n.º 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();
        }
Ejemplo n.º 3
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()
        }
Ejemplo n.º 4
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();
        }
Ejemplo n.º 5
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            BankAccount account = new BankAccount("123-4567890-12");

            account.Deposit(200);
            WriteToConsole(account);
            account.Withdraw(100);
            WriteToConsole(account);
            IEnumerable <Transaction> transactions = account.GetTransactions(null, null);

            foreach (Transaction item in transactions)
            {
                Console.WriteLine($"Transaction: {item.DateOfTrans} - {item.Amount} - {item.TransactionType}");
            }
        }
Ejemplo n.º 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();
        }