按下列公式计算银行贷款等额还款的月偿还金额S:
现要求编写VB程序(运行界面如图所示),实现如下功能:在文本框架中输入贷款本金、贷款期限、年利率,单击计算机按钮,在每月偿还本息额文本框中显示S的值。按此要求编写的程序如下,请把带下划线部分所缺的程序段补齐
Private Sub Command1_Click()
Dim x As Long
Dim y As Single
Dim n As Integer
Dim s As Single
x =" Val(Text1.Text)" *
n =" 12" * Val(Text2.Text)
y =" Val(Combo1.Text)" / 12 / 100 ′月利率为年利率除12
s = 1
For i =" 1" To n
s =" (1" + y) * s
Next
s =
Text4.Text = Str(s)
End Sub
其中,“等额还款”是 (Form/Text/Combo/Command)控件的Caption属性。