algorithm for rate based billing?
I need to write a program which calculates an electric bill based on several tiers..
ex:
Fixed Rate (upto 100 KWh.): $100.00
Rate/KWh (100 upto 200 KWh.): $1.20
Rate/KWh (200 upto 300 KWh.): $1.50
Rate/KWh (above 300 KWh.): $250.00
the user then will input the total KWh, and then the program calculates the bill and displays it..
can someone point me in the right direction for writing an algorithm which calculates the bill? I've tried a few different ways, but none work..and each confuses me further..
thanks for any help..