-
Lenguaje
Pascal
-
Descripción
Se ingresan los nombres, código y consumo de luz de varios usuarios.
El cobro por unidad de consumo es: 140 KVH o menos: S/. 3.20
Los siguientes 170 KVH: S/. 0.15 por KVH
Exceso sobre 310 KVH: S/. 0.097 por KVH
Por cada usuario se debe mostrar sus datos y monto a pagar.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
program CobroDelConsumoDeLuz0140310YMasKvh;
uses crt;
var consumo_en_kvh, monto_a_pagar : real;
var nombre, codigo : string;
var tecla_repetir : char;
begin
repeat
clrscr;
write ('Ingresa el nombre: ');
readln (nombre);
write ('Ingresa el codigo: ');
readln (codigo);
write ('Ingresa el valor de consumo en kvh: ');
readln (consumo_en_kvh);
monto_a_pagar := 0;
if consumo_en_kvh<140 then
begin
monto_a_pagar := consumo_en_kvh*3.2;
end;
if (consumo_en_kvh>=140) and (consumo_en_kvh<=310) then
begin
monto_a_pagar := 140.0*3.2+(consumo_en_kvh-140)*0.15;
end;
if consumo_en_kvh>310 then
begin
monto_a_pagar := 140.0*3.2+170*0.15(consumo_en_kvh-310)*0.097;
end;
writeln ('Nombre: ', nombre);
writeln ('Codigo: ', codigo);
writeln ('Valor de monto a pagar: ', monto_a_pagar:0:6);
writeln;
write (#168'Deseas repetir el proceso? (S/N): ');
repeat
tecla_repetir := readkey;
until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
end.
uses crt;
var consumo_en_kvh, monto_a_pagar : real;
var nombre, codigo : string;
var tecla_repetir : char;
begin
repeat
clrscr;
write ('Ingresa el nombre: ');
readln (nombre);
write ('Ingresa el codigo: ');
readln (codigo);
write ('Ingresa el valor de consumo en kvh: ');
readln (consumo_en_kvh);
monto_a_pagar := 0;
if consumo_en_kvh<140 then
begin
monto_a_pagar := consumo_en_kvh*3.2;
end;
if (consumo_en_kvh>=140) and (consumo_en_kvh<=310) then
begin
monto_a_pagar := 140.0*3.2+(consumo_en_kvh-140)*0.15;
end;
if consumo_en_kvh>310 then
begin
monto_a_pagar := 140.0*3.2+170*0.15(consumo_en_kvh-310)*0.097;
end;
writeln ('Nombre: ', nombre);
writeln ('Codigo: ', codigo);
writeln ('Valor de monto a pagar: ', monto_a_pagar:0:6);
writeln;
write (#168'Deseas repetir el proceso? (S/N): ');
repeat
tecla_repetir := readkey;
until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
end.