public class FacadeRealWorld
public static void Main()
Mortgage m = new Mortgage();
Customer cus = new Customer("John Rambo", 22);
bool eligible = m.IsEligible(cus, 500000);
Console.WriteLine("\n{0} has been " + (eligible ? "Approved for Loan!" : "Rejected for Loan!"), cus.Name);
Insurance ins = new Insurance();
eligible = ins.IsEligibleForInsurance(cus);
Console.WriteLine("\n{0} has been " + (eligible ? "Approved for Insurance!" : "Rejected for Insurance!"), cus.Name);
public bool HasSufficientSaving(Customer c, int amount)
Console.WriteLine("Check Bank For " + c.Name);
public bool HasGoodCredit(Customer c)
Console.WriteLine("Check Credit For " + c.Name );
public bool HasGoodLoan(Customer c)
Console.WriteLine("Check Loan For " + c.Name);
public string Name {get; set;}
public int Age {get; set; }
public Customer(string name, int age){
public bool IsEligibleForInsurance(Customer cus){
Console.WriteLine("\n\n{0} applies for insurance\n", cus.Name);
private Bank b = new Bank();
private Credit c = new Credit();
private Loan l = new Loan();
public bool IsEligible(Customer cus, int amount)
Console.WriteLine("{0} applies for {1:C} loan\n", cus.Name, amount);
if (!b.HasSufficientSaving(cus, amount))
else if (!c.HasGoodCredit(cus))
else if (!l.HasGoodLoan(cus))