Programa Free Pascal
Publicado por Juan Cruz (11 intervenciones) el 16/04/2012 20:54:07
Hola, tengo un problema, a ver si me pueden ayudar...
Tengo que hacer un programa, sencillo, en free pascal, me perdi la explcacion y estoy medio confundido, el enunciado es el siguiente:
Una empresa fumigadora, cobra a los productores distintos aranceles según el tipo de fumigación y la cantidad de hectáreas.
Tipo 1 y 2 : 20 $/ha.
Tipo 3 : 30 $/ha.
Tipo 4 : 40 $/ha.
Además :
Si el área a fumigar es mayor que 100 has. se aplica un 5% de descuento.
Si el importe total supera los $1.500 se aplica un 10% de descuento, sobre la cantidad que excede los $1.500.
Determine los datos que se requieren para calcular el importe a pagar por un servicio de fumigación.
Logré hacer el programa, pero me hace todas las cuentas, y no se como lograr que si elijo por ejemplo, Tipo1, me haga solo esa cuenta, y si es mayor a 1500 me haga la cuenta correspondiente...
Esto es lo que hice en Free Pascal:
Program Ejer9;
Var
ImpT1,ImpT2,ImpT3,ImpT4,Hect,ImporteTot,Importe: Real;
Tipo1,Tipo2,Tipo3,Tipo4: Char;
Begin
Writeln('Ingrese las hectareas a fumigar');
Readln(Hect);
Writeln('ingrese el tipo de fumigacion');
Readln(Tipo1,Tipo2,Tipo3,Tipo4);
Begin
If Hect > 100 then
Importe := Hect * 20 * 0.95
else
Importe := Hect * 20;
Readln(Tipo1);
Writeln('el importe tipo1 es ',Importe:8:2);
End;
begin
If Hect > 100 then
Importe := Hect * 20 * 0.95
else
Importe := Hect * 20;
Readln(Tipo2);
Writeln('el importe tipo2 es ',Importe:8:2);
End;
begin
If Hect > 100 then
Importe := Hect * 30 * 0.95
else
Importe := Hect * 30;
Readln(Tipo3);
Writeln('el importe tipo3 es ',Importe:8:2);
End;
Begin
If Hect > 100 then
Importe := Hect * 40 * 0.95
else
Importe := Hect * 40;
Readln(Tipo4);
Writeln('el importe tipo4 es ',Importe:8:2);
End;
Begin
If Importe > 1500 then
Importe:= Importe - 1500 * 0.95 + 1500;
Writeln('el importe con descuento es ', Importe:8:2);
End;
Readln;
End.
A ver si me pueden ayudaar. Muchas Gracias.
Tengo que hacer un programa, sencillo, en free pascal, me perdi la explcacion y estoy medio confundido, el enunciado es el siguiente:
Una empresa fumigadora, cobra a los productores distintos aranceles según el tipo de fumigación y la cantidad de hectáreas.
Tipo 1 y 2 : 20 $/ha.
Tipo 3 : 30 $/ha.
Tipo 4 : 40 $/ha.
Además :
Si el área a fumigar es mayor que 100 has. se aplica un 5% de descuento.
Si el importe total supera los $1.500 se aplica un 10% de descuento, sobre la cantidad que excede los $1.500.
Determine los datos que se requieren para calcular el importe a pagar por un servicio de fumigación.
Logré hacer el programa, pero me hace todas las cuentas, y no se como lograr que si elijo por ejemplo, Tipo1, me haga solo esa cuenta, y si es mayor a 1500 me haga la cuenta correspondiente...
Esto es lo que hice en Free Pascal:
Program Ejer9;
Var
ImpT1,ImpT2,ImpT3,ImpT4,Hect,ImporteTot,Importe: Real;
Tipo1,Tipo2,Tipo3,Tipo4: Char;
Begin
Writeln('Ingrese las hectareas a fumigar');
Readln(Hect);
Writeln('ingrese el tipo de fumigacion');
Readln(Tipo1,Tipo2,Tipo3,Tipo4);
Begin
If Hect > 100 then
Importe := Hect * 20 * 0.95
else
Importe := Hect * 20;
Readln(Tipo1);
Writeln('el importe tipo1 es ',Importe:8:2);
End;
begin
If Hect > 100 then
Importe := Hect * 20 * 0.95
else
Importe := Hect * 20;
Readln(Tipo2);
Writeln('el importe tipo2 es ',Importe:8:2);
End;
begin
If Hect > 100 then
Importe := Hect * 30 * 0.95
else
Importe := Hect * 30;
Readln(Tipo3);
Writeln('el importe tipo3 es ',Importe:8:2);
End;
Begin
If Hect > 100 then
Importe := Hect * 40 * 0.95
else
Importe := Hect * 40;
Readln(Tipo4);
Writeln('el importe tipo4 es ',Importe:8:2);
End;
Begin
If Importe > 1500 then
Importe:= Importe - 1500 * 0.95 + 1500;
Writeln('el importe con descuento es ', Importe:8:2);
End;
Readln;
End.
A ver si me pueden ayudaar. Muchas Gracias.
Valora esta pregunta


0