-
Lenguaje
Pascal
-
Descripción
Una empresa extranjera de aviación fumiga cosechas contra una gran variedad de plagas. Los valores cobrados a los granjeros dependen de lo que éste desea fumigar y de cuántas hectáreas se fumigan, de acuerdo a la siguiente distribución:
- Tipo 1: fumigación contra malas hierbas, $25,000 por hectárea.
- Tipo 2: fumigación contra langostas, $37,500 por hectárea.
- Tipo 3: fumigación contra gusanos, $5,000 por hectárea.
- Tipo 4: fumigación contra todo lo anterior, $75,000 por hectárea.
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
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
program FumigacionDeCosechas;
uses crt;
var tipo_de_fumigacion : integer;
var hectareas, precio, total : real;
begin
write ('Ingresa el valor de hectareas: ');
readln (hectareas);
writeln ('Selecciona el valor de tipo de fumigacion.');
writeln (' 1.- Malas hierbas');
writeln (' 2.- Langostas');
writeln (' 3.- Gusanos');
writeln (' 4.- Todo lo anterior');
write (' : ');
repeat
readln (tipo_de_fumigacion);
if (tipo_de_fumigacion<1) or (tipo_de_fumigacion>4) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_fumigacion>=1) and (tipo_de_fumigacion<=4);
precio := 0;
if tipo_de_fumigacion=1 then
begin
precio := 25000;
end;
if tipo_de_fumigacion=2 then
begin
precio := 37500;
end;
if tipo_de_fumigacion=3 then
begin
precio := 5000;
end;
if tipo_de_fumigacion=4 then
begin
precio := 75000;
end;
total := precio*hectareas;
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var tipo_de_fumigacion : integer;
var hectareas, precio, total : real;
begin
write ('Ingresa el valor de hectareas: ');
readln (hectareas);
writeln ('Selecciona el valor de tipo de fumigacion.');
writeln (' 1.- Malas hierbas');
writeln (' 2.- Langostas');
writeln (' 3.- Gusanos');
writeln (' 4.- Todo lo anterior');
write (' : ');
repeat
readln (tipo_de_fumigacion);
if (tipo_de_fumigacion<1) or (tipo_de_fumigacion>4) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_fumigacion>=1) and (tipo_de_fumigacion<=4);
precio := 0;
if tipo_de_fumigacion=1 then
begin
precio := 25000;
end;
if tipo_de_fumigacion=2 then
begin
precio := 37500;
end;
if tipo_de_fumigacion=3 then
begin
precio := 5000;
end;
if tipo_de_fumigacion=4 then
begin
precio := 75000;
end;
total := precio*hectareas;
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.