VB语言编程

来源:百度知道 编辑:UC知道 时间:2024/05/22 10:40:29
题目:企业发放的奖金根据企业所得利润I提成,I<=10万元时奖金可提成10%;当10〈I〈=20时,低于10万的部分按10%提成,高于的部分可提成7.5%;当20<I<=40时,高出20的部分按5%提成;当I>40时,超出40的按1.5%提成。设计界面,输入当月利润I(万元),计算并显示应提成的奖金总额,要求用Select Case 语句实现。(用VB来完成)

求VB大侠帮帮忙了

Private Sub Command1_Click()
Dim dProfit As Double
Dim dBonus As Double
Dim dRate As Double

If Not IsNumeric(Text1.Text) Then
MsgBox "请输入数字"
End If

dProfit = CDbl(Me.Text1.Text)

Select Case dProfit
Case Is <= 10
dBonus = 0.1 * dProfit
Case Is <= 20
dBonus = 10 * 0.1 + (dProfit - 10) * 0.075
Case Is <= 40
dBonus = 10 * (0.1 + 0.075) + (dProfit - 20) * 0.05

Case Else
dBonus = 10 * (0.1 + 0.075 + 2 * 0.05) + (dProfit - 40) * 0.015
End Select

Me.Text2 = dBonus

End Sub

Private Sub Command1_Click()
Dim s1 '提成
1: s = InputBox(" 请输入当月利润(万):")
If Not IsNumeric(s) Then MsgBox " 请输入数字!": GoTo 1
Select Case s
Case Is >