I have to create an application that calculate parking garage fee by using VB.Net and use timepicker for time in and time out.
For each hour it cost 3$ and it calculate minutes as 1\60.
I start coding but I face problem with how can I calculate the fee and the car can’t stay overnight.. it should leave in same day…
This is my code…
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim HourlyRate As Decimal
Dim TimeIn As Double
Dim TimeOut As Double
Dim calculat As Double
HourlyRate = 3
TimeIn = DateTimePicker1.Text
TimeOut = DateTimePicker2.Text
calculat = Fee(DateTimePicker1.Text, DateTimePicker2.Text, HourlyRate)
Label1.Text = calculat.ToString + "$"
End Sub
Function Fee(ByVal TimeIn As Integer, ByVal TimeOut As Integer, _
ByVal HourlyRate As Decimal) As Decimal
Dim calculat As Double
calculat = (TimeIn - TimeOut) * HourlyRate
Return calculat
End Function
End Class