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....

Recommended Answers

All 4 Replies

You got it already. The problem is you have to Code it. Lol. Let me look at this one.

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

thanks cometburn...;). thanx for helping me

Glad to help and please mark the thread closed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.