实现上述功能的VB程序如下,请在划线处填入合适代码。
Dim price(1 To 3) As Double
Private
Sub Form_Load()
'本过程读取天然气的单价存储在数组 price 中
'代码略
End Sub
Private Sub Command1_Click()
Dim num As Integer, s As String
num =
Val(Text1.Text)
If num
< 0 Then
s =
"请输入正确的数值!"
ElseIf num
<= 360 Then
s =
Str(num * price(1))
ElseIf num
<= 540 Then
s =
Str(360 * price(1) + )
Else
s = Str(360
* price(1) + (540 - 360) * price(2) + (num - 540) * price(3))
End If
Text2.Text=
End Sub