Pascal/Turbo Pascal - ayudenme

 
Vista:

ayudenme

Publicado por miguel (2 intervenciones) el 07/11/2011 18:36:04
Estoy empesando en la programacion con pascal y necesito que me orienten para desarrollar un programa que muestre al usuario la solicitud de el monto prestado, el interes anualizado y la cantidad de meses de flujo. Mostrar en pantalla de forma columnar el mes, el saldo anterior, la amortizacion y el saldo actual.
Si alquien me puede orientar mas o menos como hacerlo le agradezco de antemano.Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

ayudenme

Publicado por ramon (2158 intervenciones) el 10/11/2011 15:47:20
{No entiendo muy bien lo que quieres espero esto te sirva de algo}

program banca;
uses
crt;
type
prestamo = record
nombre : string[50];
cantidad : real;
interes : real;
meses : integer;
saldoant : real;
amortiza : real;
saldoact : real;
end;

var
cliente : prestamo;
f : file of prestamo;

procedure entradadatos;
var
total : real;
begin
clrscr;
gotoxy(10,2);write('***** Entrada Datos Prestamo *****');
gotoxy(10,5);write('Nombre : ');
gotoxy(10,6);write('Cantidad : ');
gotoxy(10,7);write('Interes : ');
gotoxy(10,8);write('Meses : ');
gotoxy(20,5);readln(cliente.nombre);
gotoxy(20,6);readln(cliente.cantidad);
gotoxy(20,7);readln(cliente.interes);
gotoxy(20,8);readln(cliente.meses);
total := (cliente.cantidad * cliente.interes) / 100;
cliente.saldoant := cliente.cantidad + total;
cliente.amortiza := 0.0;
cliente.saldoact := cliente.cantidad;
assign(f,'c:\tp\clientes.ptm');
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
rewrite(f);
seek(f,0);
write(f,cliente);
close(f);
end
else
begin
seek(f,filesize(f));
write(f,cliente);
close(f);
end;
end;

procedure leercliente;
var
busca : longint;
encontre : boolean;
buscado : string[50];
i : integer;
begin
clrscr;
gotoxy(10,4);write('Entre Nombre Cliente a Presentar');
gotoxy(10,7);write('Nombre : ');
gotoxy(18,7);readln(buscado);
for i := 1 to length(buscado) do
begin
if buscado[i] = ' ' then
buscado[i + 1] := upcase(buscado[i + 1]);
if i = 1 then
buscado[i] := upcase(buscado[i]);
end;
assign(f,'c:\tp\clientes.ptm');
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
exit;
end
else
begin
busca := 0;
encontre := false;
repeat
seek(f,busca);
read(f,cliente);
if cliente.nombre = buscado then
begin
encontre := true
end;
busca := busca + 1;
until (encontre = true) or (busca > filesize(f) - 1);
if encontre = true then
begin
clrscr;
gotoxy(10,2);write('*** Los Datos De [',buscado,'] Son ***');
gotoxy(10,4);write('Nombre : ',cliente.nombre);
gotoxy(10,5);write('Prestamo : ',cliente.cantidad:8:2);
gotoxy(10,6);write('Interes : ',cliente.interes:8:2,'%');
gotoxy(10,7);write('Meses : ',cliente.meses);
gotoxy(10,10);write('*** Su Estado Actual Es ***');
gotoxy(10,13);write('Saldo anterior : ',cliente.saldoant:8:2);
gotoxy(10,14);write('Amortizacion : ',cliente.amortiza:8:2);
gotoxy(10,15);write('Saldo Actual : ',cliente.saldoact:8:2);
gotoxy(10,18);write('Pulse [Enter]');
readln;
end;
end;
end;

procedure actualizarcliente;
var
cambio : prestamo;
buscado : string[50];
busca, posi : longint;
import : real;
encontre : boolean;
i : integer;
begin
clrscr;
gotoxy(10,4);write('Entre Nombre Cliente a Presentar');
gotoxy(10,7);write('Nombre : ');
gotoxy(18,7);readln(buscado);
for i := 1 to length(buscado) do
begin
if buscado[i] = ' ' then
buscado[i + 1] := upcase(buscado[i + 1]);
if i = 1 then
buscado[i] := upcase(buscado[i]);
end;
assign(f,'c:\tp\clientes.ptm');
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
exit;
end
else
begin
posi := 0;
busca := 0;
encontre := false;
repeat
seek(f,posi);
read(f,cliente);
if cliente.nombre = buscado then
begin
encontre := true
end;
posi := posi + 1;
until (encontre = true) or (posi > filesize(f) - 1);
busca := posi - 1;
clrscr;
if encontre = true then
begin
seek(f,busca);
read(f,cambio);
gotoxy(10,2);write('*** Datos Entrada Amortizacion ***');
gotoxy(10,4);write('Importe : ');
gotoxy(19,4);readln(import);
cambio.saldoant := cambio.cantidad - cambio.amortiza;
cambio.amortiza := cambio.amortiza + import;
cambio.saldoact := cambio.cantidad - cambio.amortiza;
seek(f,busca);
write(f,cambio);
close(f);
end;
end;
end;
procedure cursormenu(xc, yc : integer; estado : boolean);
begin
if estado = true then
begin
gotoxy(xc,yc - 1);write('-----------------');
gotoxy(xc - 1,yc);write('|');
gotoxy(xc + 17,yc);write('|');
gotoxy(xc,yc + 1);write('-----------------');
end
else
begin
gotoxy(xc,yc - 1);write(' ');
gotoxy(xc - 1,yc);write(' ');
gotoxy(xc + 17,yc);write(' ');
gotoxy(xc,yc + 1);write(' ');
end;
end;

procedure menu;
var
tecla : char;
opcion : integer;
x, y : integer;
salida : boolean;
begin
clrscr;
gotoxy(10,2);write('<<<< MENU GENERAL USE [',chr(24),chr(25),'] Y [ENTER] >>>>');
x := 10;
y := 4;
opcion := 1;
salida := false;
gotoxy(10,4);write('entradadatos');
gotoxy(10,6);write('leercliente');
gotoxy(10,8);write('actualizarcliente');
gotoxy(10,10);write('Salir');
repeat
cursormenu(x,y,true);
tecla := readkey;
cursormenu(x,y,false);
if tecla = #80 then
begin
opcion := opcion + 1;
if opcion > 4 then
opcion := 4;
y := y + 2;
if y > 10 then
y := 10;
end;
if tecla = #72 then
begin
opcion := opcion - 1;
if opcion < 1 then
opcion := 1;
y := y - 2;

if y < 4 then
y := 4;
end;
if tecla = #13 then
begin
case opcion of
1 : begin
entradadatos;
clrscr;
end;
2 : begin
leercliente;
clrscr;
end;
3 : begin
actualizarcliente;
clrscr;
end;
4 : salida := true;
end;
gotoxy(10,2);write('<<<< MENU GENERAL USE [',chr(24),chr(25),'] Y [ENTER] >>>>');
gotoxy(10,4);write('entradadatos');
gotoxy(10,6);write('leercliente');
gotoxy(10,8);write('actualizarcliente');
gotoxy(10,10);write('Salir');
end;
until salida = true;
end;

begin
{entradadatos;
{leercliente;
actualizarcliente;}
menu;
end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

ayudenme

Publicado por miguel (2 intervenciones) el 11/11/2011 05:27:27
Claro que me sirve te agradezco que te tomaras la molestia, la verdad crei que nadie me iba a contestar, de nuevo muchas gracias.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar