Beispiel #1
0
    /// <summary>
    /// Set the "common" data elements into the data structure: LoanCommonInfo
    /// </summary>
    static public void setupBorrowerInitialData(LoanCommonInfo loanCommonInfo, decimal DownPaymentPercentage, int MonthlyIncome, int MonthlyDebt, int CreditScore, int HOAFees, int dummyVariableToDistinguishMethodSignature)
    {
        loanCommonInfo.DownPaymentPercentage = DownPaymentPercentage;
        loanCommonInfo.Income_Monthly        = MonthlyIncome;
        loanCommonInfo.Debt_Monthly          = MonthlyDebt;
        loanCommonInfo.CreditScore           = CreditScore;
        loanCommonInfo.HOA_Fees = HOAFees;

        BaseInterestRatesByLoanType interestRates = new BaseInterestRatesByLoanType();
        DebtRatios debtRatios = new DebtRatios();

        loanCommonInfo.LoanInfo_FHA30 = new LoanProviderInfo("FHA 30-year Loan", 30, interestRates.FHA30);
        // TODO: REFACTOR the max payment into the constructor for LoanProviderInfo (above line).
        loanCommonInfo.LoanInfo_FHA30.Payment_Maximum = loanCommonInfo.LoanInfo_FHA30.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_FHA30, debtRatios.DebtRatio_House_FHA30, debtRatios.DebtRatio_Total_FHA30);

        loanCommonInfo.LoanInfo_FHA25 = new LoanProviderInfo("FHA 25-year Loan", 25, interestRates.FHA25);
        loanCommonInfo.LoanInfo_FHA25.Payment_Maximum = loanCommonInfo.LoanInfo_FHA25.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_FHA25, debtRatios.DebtRatio_House_FHA25, debtRatios.DebtRatio_Total_FHA25);

        loanCommonInfo.LoanInfo_FHA20 = new LoanProviderInfo("FHA 20-year Loan", 20, interestRates.FHA20);
        loanCommonInfo.LoanInfo_FHA20.Payment_Maximum = loanCommonInfo.LoanInfo_FHA20.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_FHA20, debtRatios.DebtRatio_House_FHA20, debtRatios.DebtRatio_Total_FHA20);

        loanCommonInfo.LoanInfo_FHA15 = new LoanProviderInfo("FHA 15-year Loan", 15, interestRates.FHA15);
        loanCommonInfo.LoanInfo_FHA15.Payment_Maximum = loanCommonInfo.LoanInfo_FHA15.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_FHA15, debtRatios.DebtRatio_House_FHA15, debtRatios.DebtRatio_Total_FHA15);

        loanCommonInfo.LoanInfo_FHA10 = new LoanProviderInfo("FHA 10-year Loan", 10, interestRates.FHA10);
        loanCommonInfo.LoanInfo_FHA10.Payment_Maximum = loanCommonInfo.LoanInfo_FHA10.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_FHA10, debtRatios.DebtRatio_House_FHA10, debtRatios.DebtRatio_Total_FHA10);

        loanCommonInfo.LoanInfo_VA30 = new LoanProviderInfo("VA 30-year Loan", 30, interestRates.VA30);
        loanCommonInfo.LoanInfo_VA30.Payment_Maximum = loanCommonInfo.LoanInfo_VA30.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_VA30, debtRatios.DebtRatio_House_VA30, debtRatios.DebtRatio_Total_VA30);

        loanCommonInfo.LoanInfo_VA25 = new LoanProviderInfo("VA 25-year Loan", 25, interestRates.VA25);
        loanCommonInfo.LoanInfo_VA25.Payment_Maximum = loanCommonInfo.LoanInfo_VA25.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_VA25, debtRatios.DebtRatio_House_VA25, debtRatios.DebtRatio_Total_VA25);

        loanCommonInfo.LoanInfo_VA20 = new LoanProviderInfo("VA 20-year Loan", 20, interestRates.VA20);
        loanCommonInfo.LoanInfo_VA20.Payment_Maximum = loanCommonInfo.LoanInfo_VA20.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_VA20, debtRatios.DebtRatio_House_VA20, debtRatios.DebtRatio_Total_VA20);

        loanCommonInfo.LoanInfo_VA15 = new LoanProviderInfo("VA 15-year Loan", 15, interestRates.VA15);
        loanCommonInfo.LoanInfo_VA15.Payment_Maximum = loanCommonInfo.LoanInfo_VA15.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_VA15, debtRatios.DebtRatio_House_VA15, debtRatios.DebtRatio_Total_VA15);

        loanCommonInfo.LoanInfo_VA10 = new LoanProviderInfo("VA 10-year Loan", 10, interestRates.VA10);
        loanCommonInfo.LoanInfo_VA10.Payment_Maximum = loanCommonInfo.LoanInfo_VA10.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_VA10, debtRatios.DebtRatio_House_VA10, debtRatios.DebtRatio_Total_VA10);

        loanCommonInfo.LoanInfo_USDA30 = new LoanProviderInfo("USDA 30-year Loan", 30, interestRates.USDA30);
        loanCommonInfo.LoanInfo_USDA30.Payment_Maximum = loanCommonInfo.LoanInfo_USDA30.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_USDA30, debtRatios.DebtRatio_House_USDA30, debtRatios.DebtRatio_Total_USDA30);

        loanCommonInfo.LoanInfo_CONV30 = new LoanProviderInfo("CONV 30-year Loan", 30, interestRates.CONV30);
        loanCommonInfo.LoanInfo_CONV30.Payment_Maximum = loanCommonInfo.LoanInfo_CONV30.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_CONV30, debtRatios.DebtRatio_House_CONV30, debtRatios.DebtRatio_Total_CONV30);

        loanCommonInfo.LoanInfo_CONV25 = new LoanProviderInfo("CONV 25-year Loan", 25, interestRates.CONV25);
        loanCommonInfo.LoanInfo_CONV25.Payment_Maximum = loanCommonInfo.LoanInfo_CONV25.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_CONV25, debtRatios.DebtRatio_House_CONV25, debtRatios.DebtRatio_Total_CONV25);

        loanCommonInfo.LoanInfo_CONV20 = new LoanProviderInfo("CONV 20-year Loan", 20, interestRates.CONV20);
        loanCommonInfo.LoanInfo_CONV20.Payment_Maximum = loanCommonInfo.LoanInfo_CONV20.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_CONV20, debtRatios.DebtRatio_House_CONV20, debtRatios.DebtRatio_Total_CONV20);

        loanCommonInfo.LoanInfo_CONV15 = new LoanProviderInfo("CONV 15-year Loan", 15, interestRates.CONV15);
        loanCommonInfo.LoanInfo_CONV15.Payment_Maximum = loanCommonInfo.LoanInfo_CONV15.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_CONV15, debtRatios.DebtRatio_House_CONV15, debtRatios.DebtRatio_Total_CONV15);

        loanCommonInfo.LoanInfo_CONV10 = new LoanProviderInfo("CONV 10-year Loan", 10, interestRates.CONV10);
        loanCommonInfo.LoanInfo_CONV10.Payment_Maximum = loanCommonInfo.LoanInfo_CONV10.calculateMaxPayment(loanCommonInfo, loanCommonInfo.LoanInfo_CONV10, debtRatios.DebtRatio_House_CONV10, debtRatios.DebtRatio_Total_CONV10);
    }
Beispiel #2
0
 private static void DisplayCommonLoanInformation(LoanCommonInfo loan_info)
 {
     Console.WriteLine("Common info from initial setups: -----------------------------------");
     Console.WriteLine("Credit Score      (input from client): {0}", loan_info.CreditScore);
     Console.WriteLine("Down Payment      (input from client): {0}%", loan_info.DownPaymentPercentage);
     Console.WriteLine("Income (monthly)  (input from client): {0:C}", loan_info.Income_Monthly);
     Console.WriteLine("Debt (monthly)    (input from client): {0:C}", loan_info.Debt_Monthly);
     Console.WriteLine("HOA Fees          (input from client): {0:C}", loan_info.HOA_Fees);
     Console.WriteLine("");
 }
Beispiel #3
0
//        public Qualifier()
//        {
//            // TODO: Add constructor logic here
//        }

    /// <summary>
    /// CLIENT SPECIFIC METHOD - Do not change
    /// </summary>
    static public void setupBorrowerInitialData(LoanCommonInfo loanCommonInfo, Decimal DownPaymentPercentage, int MonthlyIncome, int MonthlyDebt, int CreditScore, int HOAFees)
    {
        loanCommonInfo.DownPaymentPercentage = DownPaymentPercentage;
        loanCommonInfo.Income_Monthly        = MonthlyIncome;
        loanCommonInfo.Debt_Monthly          = MonthlyDebt;
        loanCommonInfo.CreditScore           = CreditScore;
        loanCommonInfo.HOA_Fees = HOAFees;


        //InterestRates IR = new InterestRates();
        //loanCommonInfo.LoanInfo_FHA30 = new LoanProviderInfo("FHA 30-year Loan", 30, IR.FHA30);
        //loanCommonInfo.LoanInfo_FHA15 = new LoanProviderInfo("FHA 15-year Loan", 15, IR.FHA15);
        //loanCommonInfo.LoanInfo_VA30 = new LoanProviderInfo("VA 30-year Loan", 30, IR.VA30);
        //loanCommonInfo.LoanInfo_VA15 = new LoanProviderInfo("VA 15-year Loan", 15, IR.VA15);
        //loanCommonInfo.LoanInfo_USDA30 = new LoanProviderInfo("USDA 30-year Loan", 30, IR.USDA30);
        //loanCommonInfo.LoanInfo_CONV30 = new LoanProviderInfo("CONV 30-year Loan", 30, IR.CONV30);
        //loanCommonInfo.LoanInfo_CONV15 = new LoanProviderInfo("CONV 15-year Loan", 30, IR.CONV15);
        BaseInterestRatesByLoanType interestRates = new BaseInterestRatesByLoanType();
        DebtRatios debtRatios = new DebtRatios();

        loanCommonInfo.LoanInfo_FHA30 = new LoanProviderInfo("FHA 30-year Loan", 30, interestRates.FHA30);
        loanCommonInfo.LoanInfo_FHA25 = new LoanProviderInfo("FHA 25-year Loan", 25, interestRates.FHA25);
        loanCommonInfo.LoanInfo_FHA20 = new LoanProviderInfo("FHA 20-year Loan", 20, interestRates.FHA20);
        loanCommonInfo.LoanInfo_FHA15 = new LoanProviderInfo("FHA 15-year Loan", 15, interestRates.FHA15);
        loanCommonInfo.LoanInfo_FHA10 = new LoanProviderInfo("FHB 10-year Loan", 10, interestRates.FHA10);

        loanCommonInfo.LoanInfo_VA30 = new LoanProviderInfo("VA 30-year Loan", 30, interestRates.VA30);
        loanCommonInfo.LoanInfo_VA25 = new LoanProviderInfo("VA 25-year Loan", 25, interestRates.VA25);
        loanCommonInfo.LoanInfo_VA20 = new LoanProviderInfo("VA 20-year Loan", 20, interestRates.VA20);
        loanCommonInfo.LoanInfo_VA15 = new LoanProviderInfo("VA 15-year Loan", 15, interestRates.VA15);
        loanCommonInfo.LoanInfo_VA10 = new LoanProviderInfo("VA 10-year Loan", 10, interestRates.VA10);

        loanCommonInfo.LoanInfo_USDA30 = new LoanProviderInfo("USDA 30-year Loan", 30, interestRates.USDA30);

        loanCommonInfo.LoanInfo_CONV30 = new LoanProviderInfo("CONV 30-year Loan", 30, interestRates.CONV30);
        loanCommonInfo.LoanInfo_CONV25 = new LoanProviderInfo("CONV 25-year Loan", 25, interestRates.CONV25);
        loanCommonInfo.LoanInfo_CONV20 = new LoanProviderInfo("CONV 20-year Loan", 20, interestRates.CONV20);
        loanCommonInfo.LoanInfo_CONV15 = new LoanProviderInfo("CONV 15-year Loan", 15, interestRates.CONV15);
        loanCommonInfo.LoanInfo_CONV10 = new LoanProviderInfo("CONV 10-year Loan", 10, interestRates.CONV10);

//        calculateMaxPayment(loanCommonInfo);
    }
Beispiel #4
0
    static public void DisplayLoanInformation(LoanCommonInfo loan_info)
    {
        DisplayCommonLoanInformation(loan_info);

        Console.WriteLine("FHA30 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_FHA30, 9999);
        Console.WriteLine("FHA15 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_FHA15, 9999);
        Console.WriteLine("VA30 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_VA30, 9999);
        Console.WriteLine("VA15 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_VA15, 9999);
        Console.WriteLine("USDA30 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_USDA30, 9999);
        Console.WriteLine("CONV30 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_CONV30, 9999);
        Console.WriteLine("CONV15 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_CONV15, 9999);
        Console.WriteLine("_FHA25 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_FHA25, 9999);
        Console.WriteLine("_FHA20 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_FHA20, 9999);
        Console.WriteLine("_FHA10 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_FHA10, 9999);
        Console.WriteLine("_VA25 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_VA25, 9999);
        Console.WriteLine("_VA20 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_VA20, 9999);
        Console.WriteLine("_VA10 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_VA10, 9999);
        Console.WriteLine("_CONV25 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_CONV25, 9999);
        Console.WriteLine("_CONV20 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_CONV20, 9999);
        Console.WriteLine("_CONV10 specific info follows: -----------------------------------");
        DisplayLoanSpecificInfo(loan_info.LoanInfo_CONV10, 9999);
    }
Beispiel #5
0
    /// <summary>
    /// Invoked when an input text file is provided to iterate through.
    /// Flat-format allows multiple scenarios to be read and compared more easily.
    /// </summary>
    static public void DisplayLoanInformation_FlatFormat(LoanCommonInfo loan_info)
    {
        DisplayCommonLoanInformation(loan_info);


        // Display header for the "loan specific" data.
        // The constant formatting string. It specifies the padding.
        // ... A negative number means to left-align.
        // ... A positive number means to right-align.
        string header = String.Format("{0,-20}{1,-5}{2,-13}{3,-11}{4,-15}{5,-15}{6,-10}{7,-10}{8,-10}{9,-15}{10,-20}{11,-15}{12,-15}{13,-15}{14,-25}{15,-15}{16,-15}\n",
                                      "Type", "Term", "MaxHouseCost", "MaxPayment", "MaxBase", "MaxLoanTotal", "IntBase", "IntOffset", "IntTotal", "UpfrontMIBase",
                                      "UpfrontMIAmount", "MonthlyMIRate", "MonthlyMIPmt", "MonthlyPTRate", "MonthlyPTPayment", "MonthlyP&I", "TotalPayment");

        Console.WriteLine(header);

        //      Console.WriteLine("Type Term    MaxBase BaxLoanTotal    IntBase IntOffset   IntTotal    UpfrontMIBase   UpfrontMIAmount MonthlyMIRate   MonthlyMIPmt    MonthlyPTRate   MonthlyPTPayment    MonthlyP&I  TotalPayment");
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_CONV10);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_CONV15);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_CONV20);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_CONV25);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_CONV30);

        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_USDA30);

        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_FHA10);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_FHA15);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_FHA20);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_FHA25);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_FHA30);

        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_VA10);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_VA15);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_VA20);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_VA25);
        DisplayLoanSpecificInfo_FlatFormat(loan_info.LoanInfo_VA30);
    }
    // Al notified me that the max payment is now loan specific.   Now this logic is moved out of the common area.
    /// <summary>
    /// The Max Payment is based on monthly income vs. monthly debt.
    /// The allowed debt ratio is loan specific (the debt ratio tables that are passed in).
    ///   "This is the max you can afford on a loan"
    /// </summary>
    public int calculateMaxPayment(LoanCommonInfo loanCommonInfo, LoanProviderInfo loanProviderInfo, double[,] debtRatioTable_House, double[,] debtRatioTable_Total)
    {
        int maxPayment = 0;

        setupLookupTableIndices(loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage);

        double debtRatio_IncomeBased = debtRatioTable_House[MortgageInsuranceColumnIndex, MortgageInsuranceRowIndex];
        double debtRatio_DebtBased   = debtRatioTable_Total[MortgageInsuranceColumnIndex, MortgageInsuranceRowIndex];

        int maxPaymentAllowedBasedOnIncome = (int)(loanCommonInfo.Income_Monthly * debtRatio_IncomeBased);
        int maxPaymentAllowedBasedOnDebt   = (int)(loanCommonInfo.Income_Monthly * debtRatio_DebtBased) - loanCommonInfo.Debt_Monthly;


        if (maxPaymentAllowedBasedOnIncome > maxPaymentAllowedBasedOnDebt)
        {
            maxPayment = maxPaymentAllowedBasedOnDebt;
        }
        else
        {
            maxPayment = maxPaymentAllowedBasedOnIncome;
        }

        return(maxPayment);
    }
Beispiel #7
0
    /// <summary>
    /// CLIENT SPECIFIC DISPLAY METHOD - Do not change
    /// </summary>
    static public string DisplayLoanInformation(LoanCommonInfo loan_info, bool isThirty)
    {
        string results = string.Empty;

        //results = "<hr><ul>";
        //results += "<li>Common info from initial setups: -----------------------------------</li>";
        //results += "<li>" + String.Format("Credit Score : {0}", loan_info.CreditScore) + "</li>";
        //results += "<li>" + String.Format("Down Payment: {0}%", loan_info.DownPaymentPercentage) + "</li>";
        //results += "<li>" + String.Format("Income (monthly): {0:C}", loan_info.Income_Monthly) + "</li>";
        //results += "<li>" + String.Format("Debt (monthly): {0:C}", loan_info.Debt_Monthly) + "</li>";
        //results += "<li>" + String.Format("Maximum Payment allowed: {0:C}", loan_info.Payment_Maximum) + "</li>";
        //results += "</ul>";
        //results += "<hr>";

        if (isThirty)
        {
            results += "<table class=\"table table-striped\">";
            results += "<tr>";
            results += "</tr>";
            results += DisplayLoanSpecificInfo(loan_info.LoanInfo_FHA30);
            results += "</table>";
        }
        if (!isThirty)
        {
            results += "<table class=\"table table-striped\">";
            results += "<tr>";
            results += "</tr>";
            results += DisplayLoanSpecificInfo(loan_info.LoanInfo_FHA15);
            results += "</table>";
        }
        if (isThirty)
        {
            results += "<table class=\"table table-striped\">";
            results += "<tr>";
            results += "</tr>";
            results += DisplayLoanSpecificInfo(loan_info.LoanInfo_VA30);
            results += "</table>";
        }
        if (!isThirty)
        {
            results += "<table class=\"table table-striped\">";
            results += "<tr>";
            results += "</tr>";
            results += DisplayLoanSpecificInfo(loan_info.LoanInfo_VA15);
            results += "</table>";
        }
        if (isThirty)
        {
            results += "<table class=\"table table-striped\">";
            results += "<tr>";
            results += "</tr>";
            results += DisplayLoanSpecificInfo(loan_info.LoanInfo_USDA30);
            results += "</table>";
        }
        if (isThirty)
        {
            results += "<table class=\"table table-striped\">";
            results += "<tr>";
            results += DisplayLoanSpecificInfo(loan_info.LoanInfo_CONV30);
            results += "</table>";
        }
        if (!isThirty)
        {
            results += "<table class=\"table table-striped\">";
            results += "<tr>";
            results += "</tr>";
            results += DisplayLoanSpecificInfo(loan_info.LoanInfo_CONV15);
            results += "</table>";
        }


        return(results);
    }
Beispiel #8
0
    /// <summary>
    /// Wrapper around entry APIs.
    /// Required (from client): Down Payment (as a decimal percentage), Monthly Income, Monthly Debt, Credit Score).
    /// This method accomodates:
    ///     1) Input from a .txt file
    ///         a) Setup (named) in the ConsoleApplication_Qualifier properties in the DEBUG menu.
    ///         b)   (My test file is: C:\Users\kfultz\Documents\Visual Studio 2013\Projects\ConsoleApplication_Qualifier\ConsoleApplication_Qualifier\bin\Debug\Qualifier_input_params.txt)
    ///         c) .txt file can have multiple groups that will get iterated through.
    ///     2) Command line parameters:
    ///         a) Console.WriteLine("Down Payment percentage - args[0]: {0:P}", args[0]);
    ///         b) Console.WriteLine("Monthly Income - args[1]: {0:C}", args[1]);
    ///         c) Console.WriteLine("Monthly Debt - args[2]: {0:C}", args[2]);
    ///         d) Console.WriteLine("Credit Score - args[3]: {0}", args[3]);
    ///     3) No input parameters
    ///         a) Causes it to use some hard-coded default parameters.
    /// </summary>
    static void Main(string[] args)
    {
        LoanCommonInfo loanCommonInfo = null;

        // Some defaults for testing purposes:
        decimal downPaymentPercentage;
        int     monthlyIncome;
        int     monthlyDebt;
        int     creditScore;

        int hoaFees;  // Client requested that I allow this to be passed in and just pass it through to an output param. Value NOT USED in the actual Qualifier program.

        if (args.Length > 0)
        {
            if (File.Exists(args[0]))
            {
                // Run using a text file with input params.
                using (StreamReader sr = new StreamReader(args[0]))
                {
                    string line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        string[] parameters = line.Split(',');

                        if (parameters[0].CompareTo("DownPaymentPercentage") == 0)
                        {
                            // Skip the first parameter row since it is just header text to indicate the format for the rest of the entries.
                            // Nothing to see here... keep iterating...
                        }
                        else
                        {
                            downPaymentPercentage = decimal.Parse(parameters[0]);
                            monthlyIncome         = int.Parse(parameters[1]);
                            monthlyDebt           = int.Parse(parameters[2]);
                            creditScore           = int.Parse(parameters[3]);
                            hoaFees = int.Parse(parameters[4]);

                            loanCommonInfo = RunQualifier(downPaymentPercentage, monthlyIncome, monthlyDebt, creditScore, hoaFees);

                            Qualifier.DisplayLoanInformation_FlatFormat(loanCommonInfo);
                            Console.WriteLine("</RunQualifier> *****************************************************************************************\n");
                        }
                    }
                }
                Console.ReadKey();  // Just to pause the console window for reading.
            }
            else
            {
                // Run using single set of commandline params.
                Console.WriteLine("Number of args: {0}", args.Length);
                Console.WriteLine("Down Payment percentage - args[0]: {0:P}", args[0]);
                Console.WriteLine("Monthly Income - args[1]: {0:C}", args[1]);
                Console.WriteLine("Monthly Debt - args[2]: {0:C}", args[2]);
                Console.WriteLine("Credit Score - args[3]: {0}", args[3]);
                Console.WriteLine("HOA Fees - args[4]: {0}", args[4]);

                // values from command line
                downPaymentPercentage = decimal.Parse(args[0]);
                monthlyIncome         = int.Parse(args[1]);
                monthlyDebt           = int.Parse(args[2]);
                creditScore           = int.Parse(args[3]);
                hoaFees = int.Parse(args[4]);

                loanCommonInfo = RunQualifier(downPaymentPercentage, monthlyIncome, monthlyDebt, creditScore, hoaFees);
                Qualifier.DisplayLoanInformation(loanCommonInfo);
                Console.WriteLine("*****************************************************************************************\n");
                Console.ReadKey();  // Just to pause the console window for reading.
            }
        }
        else
        {
            // No commandline params - Run using some defaults for testing purposes:
            downPaymentPercentage = (decimal)3.0;
            monthlyIncome         = 4500;
            monthlyDebt           = 530;
            creditScore           = 680;

            hoaFees = 0;

            loanCommonInfo = RunQualifier(downPaymentPercentage, monthlyIncome, monthlyDebt, creditScore, hoaFees);
            Qualifier.DisplayLoanInformation(loanCommonInfo);
            Console.WriteLine("*****************************************************************************************\n");
            Console.ReadKey();  // Just to pause the console window for reading.
        }
        //TestLoanCalculator();
    }
Beispiel #9
0
    /// <summary>
    /// This is a good entry point for a client.
    /// Wrapper around entry APIs.
    /// Required (from client): Down Payment (as a decimal percentage), Monthly Income, Monthly Debt, Credit Score).
    /// </summary>
    public static LoanCommonInfo RunQualifier(decimal downPaymentPercentage, int monthlyIncome, int monthlyDebt, int creditScore, int hoaFees)
    {
        Qualifier      qualifier      = new Qualifier();
        LoanCommonInfo loanCommonInfo = new LoanCommonInfo();

        Qualifier.setupBorrowerInitialData(loanCommonInfo, downPaymentPercentage, monthlyIncome, monthlyDebt, creditScore, hoaFees, 9999);

        Console.WriteLine("<RunQualifier> *****************************************************************************************");

        try
        {
            // FHA 30-Year
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_FHA30, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_FHA30, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_FHA30, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_FHA30);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_FHA30, loanCommonInfo.LoanInfo_FHA30.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan - Credit Score: " + loanCommonInfo.CreditScore);
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }

        try
        {
            // FHA 15-Year
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_FHA15, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_FHA15, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_FHA15, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_FHA15);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_FHA15, loanCommonInfo.LoanInfo_FHA15.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }

        try
        {
            // VA 30-Year
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_VA30, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_VA30, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_VA30, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_VA30);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_VA30, loanCommonInfo.LoanInfo_VA30.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }

        try
        {
            // VA 15-Year
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_VA15, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_VA15, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_VA15, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_VA15);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_VA15, loanCommonInfo.LoanInfo_VA15.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }

        try
        {
            // USDA 30-Year
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_USDA30, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_USDA30, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_USDA30, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_USDA30);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_USDA30, loanCommonInfo.LoanInfo_USDA30.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }

        try
        {
            // CONV 30-Year
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_CONV30, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_CONV30, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_CONV30, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_CONV30);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_CONV30, loanCommonInfo.LoanInfo_CONV30.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }

        try
        {
            // CONV 15-Year
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_CONV15, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_CONV15, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_CONV15, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_CONV15);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_CONV15, loanCommonInfo.LoanInfo_CONV15.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }

        try
        {
            //1-May-2015: Enhancement request - add 10yr and 20yr loans...
            // _FHA25
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_FHA25, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_FHA25, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_FHA25, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_FHA25);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_FHA25, loanCommonInfo.LoanInfo_FHA25.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }

        try
        {
            //1-May-2015: Enhancement request - add 10yr and 20yr loans...
            // _FHA20
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_FHA20, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_FHA20, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_FHA20, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_FHA20);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_FHA20, loanCommonInfo.LoanInfo_FHA20.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }

        try
        {
            //1-May-2015: Enhancement request - add 10yr and 20yr loans...
            // _FHA10
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_FHA10, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_FHA10, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_FHA10, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_FHA10);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_FHA10, loanCommonInfo.LoanInfo_FHA10.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }
        try
        {
            //1-May-2015: Enhancement request - add 10yr and 20yr loans...
            // _VA25
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_VA25, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_VA25, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_VA25, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_VA25);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_VA25, loanCommonInfo.LoanInfo_VA25.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }
        try
        {
            //1-May-2015: Enhancement request - add 10yr and 20yr loans...
            // _VA20
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_VA20, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_VA20, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_VA20, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_VA20);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_VA20, loanCommonInfo.LoanInfo_VA20.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }
        try
        {
            //1-May-2015: Enhancement request - add 10yr and 20yr loans...
            // _VA10
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_VA10, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_VA10, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_VA10, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_VA10);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_VA10, loanCommonInfo.LoanInfo_VA10.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }
        try
        {
            //1-May-2015: Enhancement request - add 10yr and 20yr loans...
            // _CONV25
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_CONV25, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_CONV25, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_CONV25, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_CONV25);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_CONV25, loanCommonInfo.LoanInfo_CONV25.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }
        try
        {
            //1-May-2015: Enhancement request - add 10yr and 20yr loans...
            // _CONV20
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_CONV20, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_CONV20, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_CONV20, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_CONV20);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_CONV20, loanCommonInfo.LoanInfo_CONV20.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }
        try
        {
            //1-May-2015: Enhancement request - add 10yr and 20yr loans...
            // _CONV10
            LoanProviderInfo.setupLoanInfo(loanCommonInfo.LoanInfo_CONV10, loanCommonInfo.CreditScore, loanCommonInfo.DownPaymentPercentage, InterestRateOffsetsByLoanType.InterestRateOffsetByCreditScoreAndDownPayment_CONV10, MortgageInterestRatesByLoanType.UpfrontMortgageInterestRates_CONV10, MortgageInterestRatesByLoanType.MonthlyMortgageInterestRates_CONV10);
            LoanProviderInfo.FindBestLoanAmount(loanCommonInfo.LoanInfo_CONV10, loanCommonInfo.LoanInfo_CONV10.Payment_Maximum, loanCommonInfo.DownPaymentPercentage);
        }
        catch (IndexOutOfRangeException ex)
        {
            Console.WriteLine("Credit Score too low for this loan");
            Console.WriteLine(ex.GetType().FullName);
            Console.WriteLine(ex.Message);
        }

        return(loanCommonInfo);
    }