-
Lenguaje
Pascal
-
Descripción
Una empresa de carga brinda servicio a todo el continente americano, la tarifa que cobra por cada tonelada se muestra en el siguiente cuadro:
Destinos ($/tonelada)
Medio de transporte | Norte | Sur | Centro
Aéreo | 30 | 25 | 20
Marítimo | 25 | 20 | 15
Terrestre | 20 | 15| 10
Así mismo, si la carga que se transporta es perecible, se le incrementa el 7% del pago total de acuerdo a las toneladas.
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
program EmpresaDeCarga;
uses crt;
var destino, medio_de_transporte, perecible : integer;
var numero_de_toneladas, pago, tarifa_por_tonelada : real;
begin
write ('Ingresa el valor de numero de toneladas: ');
readln (numero_de_toneladas);
writeln ('Selecciona el valor de destino.');
writeln (' 1.- Norte');
writeln (' 2.- Sur');
writeln (' 3.- Centro');
write (' : ');
repeat
readln (destino);
if (destino<1) or (destino>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (destino>=1) and (destino<=3);
writeln ('Selecciona el valor de medio de transporte.');
writeln (' 1.- A'#130'reo');
writeln (' 2.- Mar'#161'timo');
writeln (' 3.- Terrestre');
write (' : ');
repeat
readln (medio_de_transporte);
if (medio_de_transporte<1) or (medio_de_transporte>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (medio_de_transporte>=1) and (medio_de_transporte<=3);
writeln ('Selecciona el valor de perecible.');
writeln (' 1.- Si');
writeln (' 2.- No');
write (' : ');
repeat
readln (perecible);
if (perecible<1) or (perecible>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (perecible>=1) and (perecible<=2);
tarifa_por_tonelada := 0;
if (destino=1) and (medio_de_transporte=1) then
begin
tarifa_por_tonelada := 30;
end;
if (destino=2) and (medio_de_transporte=1) then
begin
tarifa_por_tonelada := 25;
end;
if (destino=3) and (medio_de_transporte=1) then
begin
tarifa_por_tonelada := 20;
end;
if (destino=1) and (medio_de_transporte=2) then
begin
tarifa_por_tonelada := 25;
end;
if (destino=2) and (medio_de_transporte=2) then
begin
tarifa_por_tonelada := 20;
end;
if (destino=3) and (medio_de_transporte=2) then
begin
tarifa_por_tonelada := 15;
end;
if (destino=1) and (medio_de_transporte=3) then
begin
tarifa_por_tonelada := 20;
end;
if (destino=2) and (medio_de_transporte=3) then
begin
tarifa_por_tonelada := 15;
end;
if (destino=3) and (medio_de_transporte=3) then
begin
tarifa_por_tonelada := 10;
end;
pago := tarifa_por_tonelada*numero_de_toneladas;
if perecible=1 then
begin
pago := pago*1.07;
end;
writeln ('Valor de pago: ', pago:0:6);
writeln ('Valor de tarifa por tonelada: ', tarifa_por_tonelada:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var destino, medio_de_transporte, perecible : integer;
var numero_de_toneladas, pago, tarifa_por_tonelada : real;
begin
write ('Ingresa el valor de numero de toneladas: ');
readln (numero_de_toneladas);
writeln ('Selecciona el valor de destino.');
writeln (' 1.- Norte');
writeln (' 2.- Sur');
writeln (' 3.- Centro');
write (' : ');
repeat
readln (destino);
if (destino<1) or (destino>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (destino>=1) and (destino<=3);
writeln ('Selecciona el valor de medio de transporte.');
writeln (' 1.- A'#130'reo');
writeln (' 2.- Mar'#161'timo');
writeln (' 3.- Terrestre');
write (' : ');
repeat
readln (medio_de_transporte);
if (medio_de_transporte<1) or (medio_de_transporte>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (medio_de_transporte>=1) and (medio_de_transporte<=3);
writeln ('Selecciona el valor de perecible.');
writeln (' 1.- Si');
writeln (' 2.- No');
write (' : ');
repeat
readln (perecible);
if (perecible<1) or (perecible>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (perecible>=1) and (perecible<=2);
tarifa_por_tonelada := 0;
if (destino=1) and (medio_de_transporte=1) then
begin
tarifa_por_tonelada := 30;
end;
if (destino=2) and (medio_de_transporte=1) then
begin
tarifa_por_tonelada := 25;
end;
if (destino=3) and (medio_de_transporte=1) then
begin
tarifa_por_tonelada := 20;
end;
if (destino=1) and (medio_de_transporte=2) then
begin
tarifa_por_tonelada := 25;
end;
if (destino=2) and (medio_de_transporte=2) then
begin
tarifa_por_tonelada := 20;
end;
if (destino=3) and (medio_de_transporte=2) then
begin
tarifa_por_tonelada := 15;
end;
if (destino=1) and (medio_de_transporte=3) then
begin
tarifa_por_tonelada := 20;
end;
if (destino=2) and (medio_de_transporte=3) then
begin
tarifa_por_tonelada := 15;
end;
if (destino=3) and (medio_de_transporte=3) then
begin
tarifa_por_tonelada := 10;
end;
pago := tarifa_por_tonelada*numero_de_toneladas;
if perecible=1 then
begin
pago := pago*1.07;
end;
writeln ('Valor de pago: ', pago:0:6);
writeln ('Valor de tarifa por tonelada: ', tarifa_por_tonelada:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.