-
Lenguaje
Pascal
-
Descripción
La política de la compañia telefónica "chismefón" es: "Chismea + x -". Cuando se realiza una llamada, el cobro es por el tiempo que esta dura, de tal forma que los primeros cinco minutos cuestan $1.00 c/u, los siguientes tres, $0.80 c/u, los siguientes dos minutos, $0.70 c/u, y a partir del décimo minuto, $0.50 c/u. Además, se carga un impuesto de 3% cuando es domingo, y si es día hábil, en turno matutino, 15%, y en turno vespertino, 10%. Determinar cuánto debe pagar por cada concepto una persona que realiza una llamada.
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
program TelefonicaChismefon;
uses crt;
var dia_de_la_semana, impuesto, pago, subtotal, tiempo_en_minutos : integer;
var turno : integer;
begin
write ('Ingresa el valor de tiempo en minutos: ');
readln (tiempo_en_minutos);
writeln ('Selecciona el valor de dia de la semana.');
writeln (' 1.- Domingo');
writeln (' 2.- Lunes');
writeln (' 3.- Martes');
writeln (' 4.- Mi'#130'rcoles');
writeln (' 5.- Jueves');
writeln (' 6.- Viernes');
writeln (' 7.- S'#160'bado');
write (' : ');
repeat
readln (dia_de_la_semana);
if (dia_de_la_semana<1) or (dia_de_la_semana>7) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (dia_de_la_semana>=1) and (dia_de_la_semana<=7);
writeln ('Selecciona el valor de turno.');
writeln (' 1.- matutino');
writeln (' 2.- vespertino');
write (' : ');
repeat
readln (turno);
if (turno<1) or (turno>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (turno>=1) and (turno<=2);
if tiempo_en_minutos<=5 then
begin
subtotal := tiempo_en_minutos;
end;
if (tiempo_en_minutos>5) and (tiempo_en_minutos<=7) then
begin
subtotal := 5.0+(tiempo_en_minutos-2)*0.8;
end;
if (tiempo_en_minutos>7) and (tiempo_en_minutos<=10) then
begin
subtotal := 5.0+2.0*0.8+(tiempo_en_minutos-7)*0.7;
end;
if tiempo_en_minutos>10 then
begin
subtotal := 5.0+2.0*0.8+3.0*0.7+(tiempo_en_minutos-10)*0.5;
end;
impuesto := 0;
if dia_de_la_semana=1 then
begin
impuesto := subtotal*0.03;
end;
if (dia_de_la_semana<>1) and (dia_de_la_semana<>7) and (turno=1) then
begin
impuesto := subtotal*0.15;
end;
if (dia_de_la_semana<>1) and (dia_de_la_semana<>7) and (turno=2) then
begin
impuesto := subtotal*0.1;
end;
pago := subtotal+impuesto;
writeln ('Valor de impuesto: ', impuesto);
writeln ('Valor de pago: ', pago);
writeln ('Valor de subtotal: ', subtotal);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var dia_de_la_semana, impuesto, pago, subtotal, tiempo_en_minutos : integer;
var turno : integer;
begin
write ('Ingresa el valor de tiempo en minutos: ');
readln (tiempo_en_minutos);
writeln ('Selecciona el valor de dia de la semana.');
writeln (' 1.- Domingo');
writeln (' 2.- Lunes');
writeln (' 3.- Martes');
writeln (' 4.- Mi'#130'rcoles');
writeln (' 5.- Jueves');
writeln (' 6.- Viernes');
writeln (' 7.- S'#160'bado');
write (' : ');
repeat
readln (dia_de_la_semana);
if (dia_de_la_semana<1) or (dia_de_la_semana>7) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (dia_de_la_semana>=1) and (dia_de_la_semana<=7);
writeln ('Selecciona el valor de turno.');
writeln (' 1.- matutino');
writeln (' 2.- vespertino');
write (' : ');
repeat
readln (turno);
if (turno<1) or (turno>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (turno>=1) and (turno<=2);
if tiempo_en_minutos<=5 then
begin
subtotal := tiempo_en_minutos;
end;
if (tiempo_en_minutos>5) and (tiempo_en_minutos<=7) then
begin
subtotal := 5.0+(tiempo_en_minutos-2)*0.8;
end;
if (tiempo_en_minutos>7) and (tiempo_en_minutos<=10) then
begin
subtotal := 5.0+2.0*0.8+(tiempo_en_minutos-7)*0.7;
end;
if tiempo_en_minutos>10 then
begin
subtotal := 5.0+2.0*0.8+3.0*0.7+(tiempo_en_minutos-10)*0.5;
end;
impuesto := 0;
if dia_de_la_semana=1 then
begin
impuesto := subtotal*0.03;
end;
if (dia_de_la_semana<>1) and (dia_de_la_semana<>7) and (turno=1) then
begin
impuesto := subtotal*0.15;
end;
if (dia_de_la_semana<>1) and (dia_de_la_semana<>7) and (turno=2) then
begin
impuesto := subtotal*0.1;
end;
pago := subtotal+impuesto;
writeln ('Valor de impuesto: ', impuesto);
writeln ('Valor de pago: ', pago);
writeln ('Valor de subtotal: ', subtotal);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.