Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            Approver chainOfApprovers = GetChainOfApprovers();

            Console.WriteLine("PHONE LOAN");
            chainOfApprovers.ApproveLoan(123);

            Console.WriteLine("\nBIKE LOAN");
            chainOfApprovers.ApproveLoan(1234);

            Console.WriteLine("\nHOUSE LOAN");
            chainOfApprovers.ApproveLoan(12345);
        }
Ejemplo n.º 2
0
 public void ApproveLoan(int amount)
 {
     if (amount <= maxApproveAmount)
     {
         Notify(true);
     }
     else
     {
         Notify(false);
         if (nextApprover != null)
         {
             nextApprover.ApproveLoan(amount);
         }
     }
 }