Ayuda con programacion?

Dado como dato la cantidad de kilovatios consumidos por el usuario en un mes,

Los pasos a seguir son:  

a. Ingresar la cantidad de KW consumidos en el mes.

  b. Calcular el importe a pagar (utilizando alternativas anidadas) de la siguiente  

manera :

Si el kw <= 200 calcular el total a pagar = kw * 2

Si el kw > 200 y kw < 1000 calcular el total a pagar = kw * 2.50

Si el kw > 1000 calcular el total a pagar = kw * 3

  c. Finalmente mostramos en pantalla el total a pagar    

 

1 Answer

Relevance
  • Zyzzyx
    Lv 7
    3 weeks ago

    Well Javier, I would have to answer in English.

    I know about the electrical relationships, but not enough Spanish to express it.

    So, let's see:

    a. Input the quantity of KW (kilowatts) consumed in a month

    --- I think this should be KWH for kilowatt HOURS, so I'm going to do that

    b. Calculate the payments as follows (??)

    If the KWH <= 200 then the cost is 2 (cents? dollars? pesos?) per KWH

    If the KWH > 200 and < 1000 the cost is 2.50 per KWH

    If the KWH > 1000 the cost is 3 per KWH

    But I'm obviously missing something. 

    You need some way to express this "step function" but what?

Still have questions? Get your answers by asking now.