The electricity accounts of residents in a very small town are calculated as follows: v If 250 units or fewer are used, the cost is 2 cents per unit; v If more than 250 but not more than 800 units are used, the cost is $10 for the first 250 units and 5 cents for every unit in the excess of 250. v If more than 800 units are used, the cost is $35 for the first 800 units plus 10 cents for every unit in the excess of 800. v A basic service fee of $5 is charged, no matter how much electricity is used. Write a user-defined function program to calculate the fees of any electricity unit, and then write a command to calculate the fee of a resident who used 700 electricity units.

Respuesta :

Answer:

For you first question about the defined function program:

if ( v ≤ 250 ) {

   set p to (5 + v*.02)

}

elseif ( 250 ≤ v ≤ 800 ) {

   set p to (5 + 2500 + (v - 250)*.02)

}

else {

   set p to (5 + 28000 + (v - 800)*.1)

}

This function will first check if the user has used how many units and decide which category that user falls into.

Then, it uses that information to execute a command to calculate how much money that user should pay for the electricity bill, factoring in the extra demands from the question.

For your second question:

(5 + 2500 + (700 - 250)*.02)

= (3000 + 450*.02)

= (3000 + 9)

= 3009

The customer should have paid 3009 dollars.

Explanation:

Hope this helped!

ACCESS MORE