-
Lenguaje
Pascal
-
Descripción
La asociación de viticultores tiene como política fijar un precio inicial al kilo de uva, la cual se clasifican en tipos A y B, y además en tamaños 1 y 2. Cuando se realiza la venta del producto, este es de un sólo tipo y tamaño. Se requiere determinar cuanto recibirá un productor por la uva que entrega en un embarque, considerando lo siguiente: si es de tipo A se le carga 0.20 al precio inicial cuando es de tamaño 1; y 0.30 si es de tamaño 2. si es de tipo B se rebajan 0.30 cuando es de tamaño 1, y .50 cuando es de tamaño 2. Realize un programa para determinar la ganancia obtenida.
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
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
program GananciaDeUnProductorDeUva;
uses crt;
var tamano, tipo : integer;
var kilos_de_uva, precio_fijado_por_kilo, subtotal, total : real;
begin
write ('Ingresa el valor de kilos de uva: ');
readln (kilos_de_uva);
write ('Ingresa el valor de precio fijado por kilo: ');
readln (precio_fijado_por_kilo);
writeln ('Selecciona el valor de tipo.');
writeln (' 1.- A');
writeln (' 2.- B');
write (' : ');
repeat
readln (tipo);
if (tipo<1) or (tipo>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo>=1) and (tipo<=2);
writeln ('Selecciona el valor de tamano.');
writeln (' 1.- uno');
writeln (' 2.- dos');
write (' : ');
repeat
readln (tamano);
if (tamano<1) or (tamano>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tamano>=1) and (tamano<=2);
subtotal := precio_fijado_por_kilo*kilos_de_uva;
if (tipo=1) and (tamano=1) then
begin
total := subtotal*1.2;
end;
if (tipo=1) and (tamano=2) then
begin
total := subtotal*1.3;
end;
if (tipo=2) and (tamano=1) then
begin
total := subtotal*0.7;
end;
if (tipo=2) and (tamano=2) then
begin
total := subtotal*0.5;
end;
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var tamano, tipo : integer;
var kilos_de_uva, precio_fijado_por_kilo, subtotal, total : real;
begin
write ('Ingresa el valor de kilos de uva: ');
readln (kilos_de_uva);
write ('Ingresa el valor de precio fijado por kilo: ');
readln (precio_fijado_por_kilo);
writeln ('Selecciona el valor de tipo.');
writeln (' 1.- A');
writeln (' 2.- B');
write (' : ');
repeat
readln (tipo);
if (tipo<1) or (tipo>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo>=1) and (tipo<=2);
writeln ('Selecciona el valor de tamano.');
writeln (' 1.- uno');
writeln (' 2.- dos');
write (' : ');
repeat
readln (tamano);
if (tamano<1) or (tamano>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tamano>=1) and (tamano<=2);
subtotal := precio_fijado_por_kilo*kilos_de_uva;
if (tipo=1) and (tamano=1) then
begin
total := subtotal*1.2;
end;
if (tipo=1) and (tamano=2) then
begin
total := subtotal*1.3;
end;
if (tipo=2) and (tamano=1) then
begin
total := subtotal*0.7;
end;
if (tipo=2) and (tamano=2) then
begin
total := subtotal*0.5;
end;
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.