I am not able to generate a correct program for the electricity bill.I also don't know how the program will work. Is there anyone who can help me out with my question??? use the following info-
for first 100 units-.4bucks per unit is charged
for the next 200 -.5 bucks
beyond 300-.6bucks
also all the users are charged meter charge which is 50bucks.
Please post your non-working code. We won't do your homework for you.
Here is a start (at least an algorithm):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
int main() {
// 1. Prompt the user to enter the number of units consumed
// 2. Read the user's input
// 3. if consumed is less than or equal to 100, then
// cost is .4 * consumed
// otherwise if consumed is less than or equal to 300, then
// cost is .4 * the first 100 plus .5 times the consumption less the first 100
// otherwise
// cost is .4 * the first 100 + .5 times the next 200 plus .6 times the
// consumption less the first 300.
// 4. Add to the cost the flat 50 buck meter charge
// 5. Output the result
}