Solved

# Calculate a value using a IF statement

Posted on 2000-03-05

I am working on a application and have had great difficulty with this calculation.

This has a choice of 2 seasons for rates

the first is standard. It is the second one I need a hint with.

when selected a clacualtion needs to take place.

if txtKilowatt = 0 then the cost equals a flat rate of 10.00 assigned to txtCost.text

basic flat rate of $10.00 regardless of usage (even 0 kilowatthours)

or if txtKilowatt<= 400 then rate = .08 per kilowatt

or if txtKilowatt>= 401 and less than 800 then rate = .06 per kilowatt

or if txtKilowatt>= 800 then rate = .04 per kilowatt

The values are calculated as follows eg.

txtKiloWatt.text = 850

8 cents per kilowatthour for the 1st 400 kilowatt-hours used

6 cents per kilowatthour for 401 to 800 (8 cents for the 1st 400)

and 4 cents per kilowatthour for 801 and above (plus the 8 and 6)

The final value is the rate * taxrate of 8%

any help would be greatly appreciated.

Regards Webgrrl