Dim km As Long
Dim money As Long
km = Val(Text1)
Select Case km
Case Is <= 3
money = 10 '3公里内10元
Case Is >3 And km <槐租= 20
money = (km - 3) * 2.1 + 10 '3公里外2.1元者明旦每公里 加上3公里内的10元
Case Is >20
money = (km - 3) * 2.1 + (km - 3) + 10 '在第二条的基础上,超3公首扰里每公里加1元
End Select
Text2 = money
字体大小胡宏自己设置和咐:
Private Sub Command1_Click()
Command1.Enabled = False
Command2.Enabled = True
Text1 = Right(Now(), 8)
End Sub
Private Sub Command2_Click()
Command2.Enabled = False
Command1.Enabled = True
Text2 = Right(Now(), 8)
h1 = CInt(Left(Text1, 2))
m1 = CInt(Mid(Text1, 4, 2))
s1 = CInt(Right(Text1, 2))
h2 = CInt(Left(Text2, 2))
m2 = CInt(Mid(Text2, 4, 2))
s2 = CInt(Right(Text2, 2))
t = 60 * (h2 - h1) + m2 - m1 + (s2 - s1) / 60
If t <= 3 Then
y = 0.5
Else
y = 0.5 + 0.15 * Int(t - 3 + 0.999)
End If
Text3 = y
If Left(Text3, 1) = "." Then Text3 = "0" &Text3
End Sub
Private Sub Form_Load()
Label1.Caption = "开始时间"
Label2.Caption = "结束时间"
Label3.Caption = "通话费用"
Text1 = ""
Text2 = ""唤做纯
Text3 = ""
Command1.Caption = "通话开始"
Command2.Enabled = False
Command2.Caption = "通话结束"
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)