コード例 #1
0
        public static void Main()
        {
            // Some accounts
            Deposite firstDeposite  = new Deposite(Customers.Companies, 100000, 1.4m);
            Deposite secondDeposite = new Deposite(Customers.Individuals, 2500, 3.4m);

            Loan firstLoan  = new Loan(Customers.Companies, 2400000m, 2.7m);
            Loan secondLoan = new Loan(Customers.Individuals, 7500, 1.001m);

            Mortgage firstMortgage  = new Mortgage(Customers.Companies, 12400m, 5.1m);
            Mortgage secondMortgage = new Mortgage(Customers.Individuals, 4500, 0.11m);

            // Add and with draw some money
            firstDeposite.WithDrawMoney(1000.0m);
            secondDeposite.DepositeMoney(1000.0m);
            secondLoan.DepositeMoney(100);
            firstMortgage.DepositeMoney(600);

            // Calculate interests of amount
            decimal firstAmount = firstDeposite.CalculateInterestAmount(12);

            Console.WriteLine("Interest amount {0:F3} %", firstAmount);

            decimal secondAmount = firstMortgage.CalculateInterestAmount(7);

            Console.WriteLine("Interest amount {0:F3} %\n", secondAmount);

            // Create a bank
            Bank bank = new Bank();

            // Adding some accounts in the bank
            bank.AddDepositeAccount(firstDeposite, secondDeposite);
            bank.AddLoanAccount(firstLoan, secondLoan);
            bank.AddMortgageAccount(firstMortgage, secondMortgage);

            // Print information about all account in the bank
            Console.WriteLine(bank.DepositeAccounts);
            Console.WriteLine(bank.LoanAccounts);
            Console.WriteLine(bank.MortgageAccounts);
        }
コード例 #2
0
        static void Main()
        {
            Deposite depositeIndividualStanimir       = new Deposite(new Individual("Stanimir"), 2003, 5);
            Deposite depositeCompanyGeograficNational = new Deposite(new Company("GeograficNational"), 198032, 17);
            Loan     loanIndividualGerasim            = new Loan(new Individual("Gerasim"), 315, 2);
            Loan     loanCompanyTouristOOD            = new Loan(new Company("TouristOOD"), 43707, 9);
            Mortgage mortgageIndividualPetkan         = new Mortgage(new Individual("Petkan"), 200, 6);
            Mortgage mortgageCompanySoftCom           = new Mortgage(new Company("SoftCom"), 299387, 19);

            Console.WriteLine(new string('-', 80));

            Bank alianzBank = new Bank("Alianz");

            alianzBank.AddAccount(depositeIndividualStanimir);
            alianzBank.AddAccount(depositeCompanyGeograficNational);
            alianzBank.AddAccount(loanIndividualGerasim);
            alianzBank.AddAccount(loanCompanyTouristOOD);
            alianzBank.AddAccount(mortgageIndividualPetkan);
            alianzBank.AddAccount(mortgageCompanySoftCom);

            Console.WriteLine(alianzBank.ToString());
        }
コード例 #3
0
ファイル: Test.cs プロジェクト: g-yonchev/Telerik-Academy
        public static void Main()
        {
            // Some accounts
            Deposite firstDeposite = new Deposite(Customers.Companies, 100000, 1.4m);
            Deposite secondDeposite = new Deposite(Customers.Individuals, 2500, 3.4m);

            Loan firstLoan = new Loan(Customers.Companies, 2400000m, 2.7m);
            Loan secondLoan = new Loan(Customers.Individuals, 7500, 1.001m);

            Mortgage firstMortgage = new Mortgage(Customers.Companies, 12400m, 5.1m);
            Mortgage secondMortgage = new Mortgage(Customers.Individuals, 4500, 0.11m);

            // Add and with draw some money
            firstDeposite.WithDrawMoney(1000.0m);
            secondDeposite.DepositeMoney(1000.0m);
            secondLoan.DepositeMoney(100);
            firstMortgage.DepositeMoney(600);

            // Calculate interests of amount
            decimal firstAmount = firstDeposite.CalculateInterestAmount(12); 
            Console.WriteLine("Interest amount {0:F3} %", firstAmount);

            decimal secondAmount = firstMortgage.CalculateInterestAmount(7);
            Console.WriteLine("Interest amount {0:F3} %\n", secondAmount);

            // Create a bank
            Bank bank = new Bank();

            // Adding some accounts in the bank
            bank.AddDepositeAccount(firstDeposite, secondDeposite);
            bank.AddLoanAccount(firstLoan, secondLoan);
            bank.AddMortgageAccount(firstMortgage, secondMortgage);

            // Print information about all account in the bank
            Console.WriteLine(bank.DepositeAccounts);
            Console.WriteLine(bank.LoanAccounts);
            Console.WriteLine(bank.MortgageAccounts);
        }