コード例 #1
0
        public bool IsEligible(Customer cust, int amount)
        {
            Console.WriteLine(
                "{0} applies for {1:C} loan\n",
                cust.Name, 
                amount);

            bool eligible = true;

            // Check creditworthyness of applicant
            if (!this.bank.HasSufficientSavings(cust, amount))
            {
                eligible = false;
            }
            else if (!this.loan.HasNoBadLoans(cust))
            {
                eligible = false;
            }
            else if (!this.credit.HasGoodCredit(cust))
            {
                eligible = false;
            }

            return eligible;
        }
コード例 #2
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        public static void Main()
        {
            // Facade
            Mortgage mortgage = new Mortgage();

            // Evaluate mortgage eligibility for customer
            Customer customer = new Customer("Pesho");

            bool eligible = mortgage.IsEligible(customer, 125000);

            Console.WriteLine();
            Console.WriteLine("{0} has been {1}", customer.Name, eligible ? "Approved" : "Rejected");
        }
コード例 #3
0
        public bool HasGoodCredit(Customer c)
        {
            Console.WriteLine("Check credit for {0}", c.Name);

            return true;
        }
コード例 #4
0
ファイル: Bank.cs プロジェクト: HansS/TelerikAcademy-homework
        public bool HasSufficientSavings(Customer c, int amount)
        {
            Console.WriteLine("Check bank for " + c.Name);

            return true;
        }
コード例 #5
0
ファイル: Loan.cs プロジェクト: HansS/TelerikAcademy-homework
        public bool HasNoBadLoans(Customer c)
        {
            Console.WriteLine("Check loans for {0}", c.Name);

            return true;
        }