做一道VB程序题

来源:百度知道 编辑:UC知道 时间:2024/05/14 14:03:56
1.欧洲科学家用于预测子女身高的计算公式如下:
儿子成年身高(cm)=(父亲身高+母亲身高)*1.08/2
女儿成年身高(cm)=(父亲身高*0.923+母亲身高)/2
根据上述计算公式编写运行介面的程序,在文本框中分别输入父亲身高和母亲身高之后,单击“男孩”或“女孩”单选按钮,即在标签Label中输出预测结果。

把程序贴上来就好了 恩 今天被baidu吞掉了一百分所以实在没办法给大家高分了……抱歉

'添加控件 Label1、Label2、Label3、Text1、Text2、Command1、Command2

Private Sub Command1_Click()
'计算男孩身高
Label3.Caption = (Val(Text1.Text) + Val(Text2.Text)) * 1.08 / 2
End Sub

Private Sub Command2_Click()
'计算女孩身高
Label3.Caption = (Val(Text1.Text) * 0.923 + Val(Text2.Text)) / 2
End Sub

Private Sub Form_Load()
'加载各控件属性
With Me
.Height = 2715
.Width = 3045
End With

With Label1
.Caption = "父亲身高"
.AutoSize = True
.Left = 360
.Top = 240
End With

With Label2
.Caption = "母亲身高"
.AutoSize = True
.Left = 360
.Top = 720
End With

With Label3
.Caption = ""
.AutoSize = True
.Left = 480
.Top = 1200
End With

With Text1
.Text = ""
.Left = 1440
.Top = 120
.Height = 375
.Width = 1215
End With

With Text2
.Tex