Quality is delighting customers
convert the electricity billing application to the function & call the same function from a same function for the following req:
1. the no.of units consumed r charges.
a.100 units will cost 2rs/units
b.200 units will cost 4rs/units
c. 300units will cost 6rs/units
d. remaining will cost 8rs/units
2. if any outstanding pending amount should be add in current month calculation
3.3% of fine should be added amount if any
I am very much surprised that you are asking the code for the given problem. I want to understand whether you are not aware of syntax to write "IF" control statement or you are not sure of the logic. Simple "IF... ELSEIF.." will resolve the problem.
I understood that you are learning vbscript. Please don't mind but I wanted to suggest you that ask the technical issues here not the logic of the program. Believe me, even I tell you the logic; it won't help you. Logic is something that you need to understand, it should not be memorized.
Well, here is the simple logic for your problem:
Lets take an example that total unit consumed is 1000 units then how much it will cost?
for 1st 100 unit the cost will be 100 x 2 = Rs. 200 , now remaining units is 1000 - 100 = 900 units
for next 200 unit the cost will be 200 x 4 = Rs 800, now remaining units is 900 - 200 = 700 units
for next 300 unit the cost will be 300 x 6 = Rs. 1800, now remaining units is 700 - 300 = 400 units
for remaining 400 unit cost will be 400 x 8 = Rs 3200
Now do the total =200 + 800 +1800 +3200 = Rs 6000
Can't you write "IF statement' for this?