早教吧 育儿知识 作业答案 考试题库 百科 知识分享

excel里的VB语句怎么写?定义一个过程Bonus,在该过程内部定义三个long型变量:performance,salary,Bonus,设salary=5000.用InputBox 函数:请求用户输入:“请输入performance 的值:”,并赋值给performance,根据

题目详情
excel里的VB语句怎么写?
定义一个过程Bonus,在该过程内部定义三个long型变量:performance,salary,Bonus,设salary=5000.
用InputBox 函数:请求用户输入:“请输入performance 的值:”,并赋值给performance,根据以下规则来计算Bonus:
如果performance = 1 则Bonus = salary * 0.1
如果performance = 2 则Bonus = salary * 0.09
如果 performance = 3 Then Bonus = salary * 0.07
否则Bonus = 0
并将结果用Msgbox显示.
▼优质解答
答案和解析
Sub ply()
Dim performance As Long
Dim salary As Long
Dim Bonus As Long
salary = 5000
performance = InputBox("请输入performance 的值:")
If performance = 1 Then
Bonus = salary * 0.1
ElseIf performance = 2 Then
Bonus = salary * 0.09
ElseIf performance = 3 Then
Bonus = salary * 0.07
Else
Bonus = 0
End If
MsgBox Bonus
End Sub
测试成功!
张志晨