把这段代码复制,在窗体里只需建一个Command1控件即可。
Private Sub Command1_Click()
Dim s
s = Val(Trim(InputBox("个人收入:", "个人所得税计算", 2000)))
Print "个人收入为"s"元时,应缴纳的个人所得税为"
If s <= 1600 Then
Print 0
Else
s = s - 1600 '如果个人收入高于起征点,则计算个人应得额
Select Case s
Case Is <= 500: s = s * 0.05
Case Is <= 2000: s = s * 0.1 - 25
Case Is <= 5000: s = s * 0.15 - 125
Case Is <= 20000: s = s * 0.2 - 375
Case Is <= 40000: s = s * 0.25 - 1375
Case Is <= 60000: s = s * 0.3 - 3375
Case Is <= 80000: s = s * 0.35 - 6375
Case Is <= 100000: s = s * 0.4 - 10375
Case Is >1000000: s = s * 0.45 - 15375
End Select
Print Format(s,"0.00") '如果个人收入是带小数的,则用Format控制格式
End If
End Sub
代码文本:
#include "stdio.h"
int main(int argc,char *argv[]){
double x,tax
printf("Please enter the number salary, negative end...\n")
while(scanf("%lf",&x),x>=0){
if(x>=5000)
tax=(x-5000)*0.2+4200*.03
else if(x>=800 &&x<5000)
tax=(x-800)*.03
else
tax=0
printf("You should pay %.2f yuan.\n",tax)
}
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)