Exemplo n.º 1
0
        static void Main()
        {
            Customer kircho = new Individual("a001", "Kiro", "8503122535", new DateTime(1990, 10, 25), Gender.Male);

            Customer firmata = new Company("a002", "p2p", "503122535");

            Console.WriteLine(firmata is Individual);
            Console.WriteLine(kircho is Individual);

            BankAccount mortgageAccTest  = new MortgageAccount(200.2m, 0.6m, kircho);
            BankAccount mortgageAccTest1 = new MortgageAccount(200.2m, 0.6m, firmata);

            Console.WriteLine(mortgageAccTest.CalculateInterest(15));
            Console.WriteLine(mortgageAccTest1.CalculateInterest(15));

            BankAccount loanAccTest  = new LoanAccount(200.2m, 0.6m, kircho);
            BankAccount loanAccTest1 = new LoanAccount(200.2m, 0.6m, firmata);

            Console.WriteLine(loanAccTest.CalculateInterest(11));
            Console.WriteLine(loanAccTest1.CalculateInterest(11));

            BankAccount depositAccTest  = new DepositAccount(3200.2m, 0.6m, kircho);
            BankAccount depositAccTest1 = new DepositAccount(1200.2m, 0.6m, firmata);

            Console.WriteLine(depositAccTest.CalculateInterest(11));
            Console.WriteLine(depositAccTest1.CalculateInterest(11));

            depositAccTest.Deposit(200);
            Console.WriteLine(depositAccTest.Balance);
            var depositAcc = depositAccTest as DepositAccount;

            depositAcc.Withdraw(300);
            Console.WriteLine(depositAcc.Balance);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Bank currentBank = new Bank("My Bank");

            DepositAccount depositAcc = new DepositAccount(new IndividualCustomer("pesho"), 3564.0m, 15);

            LoanAccount loanAcc = new LoanAccount(new CompanyCustomer("gosho inc."), 55678.54m, 22);

            MortgageAccount mortgageAcc = new MortgageAccount(new IndividualCustomer("tosho"), 21354.66m, 17);

            depositAcc.DepositMoney(150);
            depositAcc.WithdrawMoney(50);

            loanAcc.DepositMoney(200);

            mortgageAcc.DepositMoney(500);

            currentBank.AddAccount(depositAcc);
            currentBank.AddAccount(loanAcc);
            currentBank.AddAccount(mortgageAcc);

            //Console.WriteLine(currentBank);

            int numberOfMonths = 14;

            decimal calcInterest = depositAcc.CalculateInterest(numberOfMonths);

            Console.WriteLine(depositAcc + "calculated interest: {0:C3}", calcInterest);

            calcInterest = loanAcc.CalculateInterest(numberOfMonths);
            Console.WriteLine(loanAcc + "calculated interest: {0:C3}", calcInterest);

            calcInterest = mortgageAcc.CalculateInterest(numberOfMonths);
            Console.WriteLine(mortgageAcc + "calculated interest: {0:C3}", calcInterest);
        }
Exemplo n.º 3
0
        static void Main()
        {
            Customers kris = new Individuals("Kris", "65654756765", "Sofia", new DateTime(1990, 10, 25));

            Customers krisOOD = new Companies("Kris OOD", "65654656765", "Plovdiv", 325343);

            Console.WriteLine(krisOOD is Individuals);
            Console.WriteLine(kris is Individuals);

            Bank mortgageAccTest  = new MortgageAccount(200.2m, 0.6m, kris);
            Bank mortgageAccTest1 = new MortgageAccount(200.2m, 0.6m, krisOOD);

            Console.WriteLine(mortgageAccTest.CalculateInterest(15));
            Console.WriteLine(mortgageAccTest1.CalculateInterest(15));

            Bank loanAccTest  = new LoanAccount(200.2m, 0.6m, kris);
            Bank loanAccTest1 = new LoanAccount(200.2m, 0.6m, krisOOD);

            Console.WriteLine(loanAccTest.CalculateInterest(11));
            Console.WriteLine(loanAccTest1.CalculateInterest(11));

            Bank depositAccTest  = new DepositAccount(3200.2m, 0.6m, kris);
            Bank depositAccTest1 = new DepositAccount(1200.2m, 0.6m, krisOOD);

            Console.WriteLine(depositAccTest.CalculateInterest(11));
            Console.WriteLine(depositAccTest1.CalculateInterest(11));

            depositAccTest.Deposit(200);
            Console.WriteLine(depositAccTest.Balance);
            var depositAcc = depositAccTest as DepositAccount;

            depositAcc.Draw(300);
            Console.WriteLine(depositAcc.Balance);
        }