Automobile Loan Calculator - in vb.net
发布时间:2020-12-17 07:33:40 所属栏目:百科 来源:网络整理
导读:'学习心得'运算符的优先级'变量名的制定:g(是否是全局)+数据类型+变量=变量名;gdblName' AcceptButton Property of the Form specifies this button.When the user press the Enter key or clicks the default button on a form that has the AcceptButt
'学习心得 '运算符的优先级 '变量名的制定:g(是否是全局)+数据类型+变量=变量名;gdblName ' AcceptButton Property of the Form specifies this button.When the user press the Enter key or clicks the default button on a form that has the AcceptButton property set. ' 'MonthlyPayment = (InterestRate*(1+InterestRate)^NumberOfPayments)/((1+InterestRate)^NumberOfPayments-1)*LoanAmount 这个在 “Pmt Founction ” 里面有 'Format Function 将日期,时间等转换成专用的格式 Option Strict On Public Class Form1 'Purpose: This project calculates the monthly payment: ' a loan based on loan amount,interest rate(利率),' Dim gdblMonths As Double = 60.0 Const MaximumLoanAllowed As Integer = 25000 Private Sub Form1_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Load nudLoanAmount.Maximum = MaximumLoanAllowed End Sub Private Sub btnReset_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles btnReset.Click nudLoanAmount.Value = 0 nudRate.Value = 5 radFiveYears.Checked = True txtMonthlyPayment.Text = "$0.00" End Sub Private Sub radTwoYears_CheckedChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles radTwoYears.CheckedChanged gdblMonths = 24.0 End Sub Private Sub radFiveYears_CheckedChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles radFiveYears.CheckedChanged gdblMonths = 12.0 * 5 End Sub Private Sub radSixYears_CheckedChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles radSixYears.CheckedChanged gdblMonths = 12.0 * 6 End Sub Private Sub btnComputePayment_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles btnComputePayment.Click Dim dblRate,dblMonths,dblPayment As Double Dim dblLoanAmount As Double,strPayment As String dblRate = (Convert.ToDouble(nudRate.Value) / 100.0) / 12.0 dblLoanAmount = Convert.ToDouble(nudLoanAmount.Value) dblPayment = Pmt(dblRate,gdblMonths,-dblLoanAmount) strPayment = Format(dblPayment,"c") 'strPayment = dblPayment.ToString ' Or use " convert.tostring(dblPayment) " txtMonthlyPayment.Text = strPayment '显示的是本机的现金符号, 如需更改请用 globlization.currentinfo End Sub End Class (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |