示例#1
0
        static void Main(string[] args)
        {
            LoanInfo info = new LoanInfo();

            info.CustName = "Courtnee & Emi";
            info.LoanNum  = "456789123";
            info.LoanAmt  = "452000";

            Console.WriteLine(info);

            AutoLoan auto = new AutoLoan();

            auto.Make   = "Pathfinder";
            auto.Model  = "Nissan";
            auto.Year   = "2013";
            auto.VIN    = "12345678912345";
            auto.CarAmt = "32000";

            Console.WriteLine(auto);

            HomeLoan home = new HomeLoan();

            home.TypeOfConstruct = "Stucco";
            home.YrBuilt         = "2013";
            home.SqFt            = "3600";
            home.HomeAmt         = "420000";

            Console.WriteLine(home);
        }
示例#2
0
 private void btnProcess_Click(object sender, EventArgs e)
 {
     lblErrorMsg.Text = "";
     if (txtBxLastName.Text == "")
     {
         lblErrorMsg.Text = "Enter last name";
         txtBxLastName.Focus();
     }
     if (txtBxFirstName.Text == "")
     {
         lblErrorMsg.Text = "Enter first name";
         txtBxFirstName.Focus();
     }
     if (txtBxLoanAmt.Text == "")
     {
         lblErrorMsg.Text = "Enter loan amount";
         txtBxLoanAmt.Focus();
     }
     if (cmboTypeOfLoan.SelectedIndex == 1)
     {
         // Code could be modified to make sure numeric values are entered prior to parsing. Better solution would involve TryParse( )
         AutoLoan car = new AutoLoan(txtBxFirstName.Text, txtBxLastName.Text, .075,
                                     double.Parse(txtBxLoanAmt.Text),
                                     int.Parse(lblYears.Text), int.Parse(txtBxAutoYear.Text),
                                     txtBxAutoModel.Text, txtBxAutoMake.Text);
         MessageBox.Show(car.ToString(), "Loan Details");
     }
     else
     if (cmboTypeOfLoan.SelectedIndex == 2)
     {
         HomeLoan condo = new HomeLoan(txtBxFirstName.Text, txtBxLastName.Text,
                                       .055, double.Parse(txtBxLoanAmt.Text),
                                       int.Parse(lblYears.Text), int.Parse(txtBxHomeYrBuilt.Text),
                                       int.Parse(txtBxHomeSqFt.Text), txtBxHomeAddress.Text);
         MessageBox.Show(condo.ToString(), "Loan Details");
     }
     else
     {
         lblErrorMsg.Text = "Select type of loan";
         cmboTypeOfLoan.Focus();
     }
 }