private void displayAmoritizationTable(MortgageData mortgage)
        {
            string tableOutput = "";

            //***********************************************************************
            //create AmortizationTable here
            //retreive the Amoritization table
            //***********************************************************************

            rtfAmortTable.Text = tableOutput;
            toolTip1.SetToolTip(rtfAmortTable, "Amortization Table for " + mortgage.FullDataString);
        }
 private void displayPayment(MortgageData mortgage)
 {
     lblAmount.Text = String.Format("{0:c}", mortgage.Payment);
     toolTip1.SetToolTip(lblAmount, "Monthly payment is: " + lblAmount.Text);
 }
        private void findMortgagePayment()
        {
            string prompt;
            bool   validPV   = false;
            bool   validAPR  = false;
            bool   validTerm = false;
            double principal = 0.0;
            double apr       = 0.0;
            int    term      = 0;

            try
            {
                if (validatePrincipalAmount())
                {
                    validPV   = true;
                    principal = double.Parse(txtMortgageAmount.Text);
                }
                else
                {
                    txtMortgageAmount.Clear();
                }
                if (validateInterestRate())
                {
                    validAPR = true;
                    apr      = double.Parse(txtInterestRate.Text);
                }
                else
                {
                    txtInterestRate.Clear();
                }
                if (validateTerm())
                {
                    validTerm = true;
                    term      = int.Parse(txtMortgageTerm.Text);
                }
                else
                {
                    txtMortgageTerm.Clear();
                }

                //***********************************************************************
                //implement input validation and set local variables  here
                //***********************************************************************
                if (validPV && validAPR && validTerm)
                {
                    MortgageData myMData = new MortgageData();

                    myMData.ID        = 007;
                    myMData.Principal = double.Parse(txtMortgageAmount.Text);
                    myMData.APR       = double.Parse(txtInterestRate.Text);
                    myMData.Term      = int.Parse(txtMortgageTerm.Text);

                    displayPayment(myMData);
                    displayAmoritizationTable(myMData);


                    //***********************************************************************
                    //declare and create a new mortgage data object
                    //invoke this class's displayPayment method
                    //invoke this class's displayAmoritizationTable method
                    //***********************************************************************
                }
                else
                {
                    lblAmount.Text = "";
                    toolTip1.SetToolTip(lblAmount, "");
                    toolTip1.SetToolTip(rtfAmortTable, "");
                    if (!validPV)
                    {
                        setInputErrorField(txtMortgageAmount);
                    }
                    else if (!validAPR)
                    {
                        setInputErrorField(txtInterestRate);
                    }
                    else
                    {
                        setInputErrorField(txtMortgageTerm);
                    }
                }
            }
            catch (Exception ex)
            {
                prompt = "Please re-enter the mortgage information and try again";
                InputUtilities.showErrorMessage(ex, prompt);
                clearFields();
            }
        }
Exemplo n.º 4
0
 public AmortizationTable(MortgageData mortInfo)
 {
     this.mortgageInformation = mortInfo;
 }