请帮忙解决这两道VB编程题

来源:百度知道 编辑:UC知道 时间:2024/09/23 06:08:10
1.给定三角形的3条边长,计算三角形面积.编写程序,首先判断给出的3条边能否构成三角形,如可以构成,则计算并输出该三角形的面积,否则要求重新输入.当输入-1时结束程序.
2.税务部门征收所得税,规定如下
(1)收入在200元以内,免征
(2)收入在200-400元内,超过200元的部分纳税3%
(3)收入超过400元部分,纳税4%
(4)当收入达5000元或超过时,将4%改成5%
编程序实现上述操作

(1)
sr
a=val(text1.text)
b=val(text2.text)
c=val(text3.text)
p=(a+b+c)/2
if a=-1 or b=-1 or c=-1 then
exit
end if
if a+b>c and a+c>b and c+b>a then
s= sql(p*(p-a)*(p-b)*(p-c))
else
goto sr
end if
(2)
两个文本框,一个用来写收入(text1),一个用来显示税额(text2)
A=val(text1.text)
Select case a
Case is<200
Text2.text=0
Case is<400
Text2.text=(a-200)*0.03
Case is<5000
Text2.text=a*0.04
Case else
Text2.text=a*0.05
End select

用 if语句写就是
If a<200 then
Text2.text=0
Else if a>=200 and a<=400 then
Text2.text=(a-200)*0.03
Else if a>400 and a<5000 then
Text2.text= a*0.04
Else if a>=5000 then
Text2.text=a*0.05
End if

1.

(d * h)/2
mei guan xi

2.

Private Sub Command1_Click()
If Text1.Text <= 200 Then
Text2.Text = "0"