VB程序的设计期末复习试题 下载本文

x=2 y=9 2.

242

3. 25

4.

A1=22 B1=33 A2=33 B2=22 5.

4 14 6. 22

7. 11 14 17 20 8.

10 9 9. 29

10. x= 5 x= 9

四、完善程序题 1.

[1]List1.AddItem Text1.Text [2]Else

[3]List1.RemoveItem List1.ListIndex [4] \修改\ [5] List1.Text [6] False

.. ..

[7] \修改确认\[8] \修改\

2.

[1]学生

[2]New Connection [3] ADOcn.Open strDB [4] New Recordset

[5] ActiveConnection [6] ADOrs.EOF [7] strSQL 3.

[1] Set ADOcn = New Connection [2] 学生.MDB [3] New

[4] ADOrs.Open strSQL [5] Not [6] Else

[7]Text1.SetFocus [8] UnLoad Me

五、编写程序题

1.参考答案:

Private Sub Command1_Click() Dim x As Integer, y As Single x = Val(Text1.Text) Select Case x Case Is >= 800 y = x * 1.2

Case Is >= 600 y = x * 1.15 Case Else y = x * 1.1 End Select

Label1.Caption = y End Sub

Private Sub Command2_Click() Unload Me

End Sub

.. ..

2.参考答案:

Private Sub Command1_Click() Dim x As Single, y As Single x = Val(Text1.Text) If x < 100 Then y = x Else

If x < 200 Then y = 9.5 * x Else

If x < 300 Then y = 0.9 * x Else

If x < 500 Then y = 0.8 * x Else

y = 0.7 * x End If End If End If End If

Text2.Text = y End Sub

3.参考答案:

Private Sub Command1_Click() Dim x As Integer, tax As Single x = Val(Text1.Text) If x < 1200 Then tax = x * 0.03 Else

If x <= 4000 Then

tax = (x - 1000) * 0.15 Else

If x <= 5000 Then

tax = (x - 1000) * 0.15 + (x - 4000) * 0.05 Else

tax = x * 0.25 End If End If End If

.. ..

Text2.Text = tax

End Sub欢迎您的光临,Word文档下载后可修改编辑.双击可删除页眉页脚.谢谢!你的意见是我进步的动力,希望您提出您宝贵的意见!让我们共同学习共同进步!学无止境.更上一层楼。

.. ..