Program Gasolinera;
USES
crt;
VAR
{tipo de combustoble}
Tipo: string;
{cantidades}
CantComun, CantGasoil, CantSuper, CantKero: integer;
{total por combustible}
Comun, Gasoil, Super, Kero: integer;
{porcentaje por combustible}
PorcenComun, PorcenGasoil, PorcenSuper, PorcenKero: real;
{total}
TotalLitros: integer;
{menu}
opcion: integer;
{volver al menu}
volver: integer;
PROCEDURE combustible;
begin
WriteLn('opcion elegida: ', opcion);
WriteLn;
Repeat
WriteLn('tenemos 4 tipos de combustible: ');
WriteLn;
WriteLn('1- Comun');
WriteLn('2- Super');
WriteLn('3- GasOil');
WriteLn('4- Kerosene');
ReadLn(Tipo);
if UPCASE(Tipo) = 'COMUN' then
begin
WriteLn('opcion elegida: ', Tipo);
WriteLn;
WriteLn('ingrese la cantidad de combustible que desea');
ReadLn(CantComun);
Comun:= Comun + CantComun;
end
else
if UPCASE(Tipo) = 'SUPER' then
begin
WriteLn('opcion elegida: ', Tipo);
WriteLn;
WriteLn('ingrese la cantidad de combustible que desea');
ReadLn(CantSuper);
Super:= Super + CantSuper;
end
else
if UPCASE(Tipo) = 'GASOIL' then
begin
WriteLn('opcion elegida: ', Tipo);
WriteLn;
WriteLn('ingrese la cantidad de combustible que desea');
ReadLn(CantGasoil);
Gasoil:= Gasoil + CantGasoil;
end
else
if UPCASE(Tipo) = 'KEROSENE' then
begin
WriteLn('opcion elegida: ', Tipo);
WriteLn;
WriteLn('ingrese la cantidad de combustible que desea');
ReadLn(CantKero);
Kero:= Kero + CantKero;
end
else
begin
WriteLn;
WriteLn('opcion inncorrecta');
WriteLn;
end;
WriteLn('ingrese (1) si quiere seguir cargando combustible ');
WriteLn('ingrese (2) si quiere volver al menu ');
ReadLn(volver);
UNTIL(volver = 2);
end;
begin
TextBackground(0);
TextColor(10);
Clrscr;
Repeat
begin
WriteLn('--sea bienvenido a la gasolinera--');
WriteLn;
WriteLn('elija la opcion a la que desea acceder');
WriteLn;
WriteLn('1- Cargar Combustible');
WriteLn('2- Mostrat total de venta por combustible');
WriteLn('3- Mostrar porcentaje de venta por combustible');
WriteLn('4- Mostrar el total vendido');
WriteLn('0- Salir');
ReadLn(opcion);
case opcion of
1:
begin
combustible;
ReadLn;
Clrscr;
end;
0:
begin
WriteLn;
WriteLn('saliendo...');
WriteLn;
readln();
end;
UNTIL(opcion=0);
end.