0

can anyone help me
i wanna calculate the total of electrical bill
this is my situation...

Rate 1 = 0.218 for first 0 – 200 KWh usage
Rate 2 = 0.289 for 201-1000 KWh usage
Electrical usage (KWh) = Latest Meter Reading - Previous Meter Reading
If electrical usage between 0 – 200 KWh,
Total payment = (Electrical usage x Rate 1) + arrears
If electrical usage between 201 - 1000 KWh,
Total payment = (Electrical usage x Rate 2) + arrears

can anyone help me on VB6 coding....

2
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by cometburn
0

here it is...

Dim Rate As Double
Dim ElectricalUsage As Double
Dim TotalPayment As Double
'get Electrical Usage
ElectricalUsage = Val(txtLatestMeterReading.Text) - Val(txtPreviousMeterReading.Text)

If ElectricalUsage <= 200 Then
    Rate = 0.218
ElseIf ElectricalUsage > 200 And ElectricalUsage <= 1000 Then
    Rate = 0.289
Else
    'Electrical Usage is greater than 1000
End If

'calculate (what's arrears anyway?)
TotalPayment = (ElectricalUsage * Rate) + arrears
MsgBox TotalPayment
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.