• Lenguaje

    Pascal

  • Descripción

    Un fondo de empleados ofrece préstamos a sus asociados con las siguientes condiciones:
    I. Antiguedad:
    - Entre 1 y 5 años: 3% de interés
    - Entre 6 y 10 años: 2% de interés
    - Entre 11 y 15 años: 1% de interés
    - Más de 15 años: no cobra interés
    II. Préstamos pendientes:
    - No debe tener préstamos pendientes
    III. Ingresos comprobados:
    - Sueldo mínimo: se le presta 3.000.000
    - 2 salarios mínimos: se le presta 5.000.00
    - 3 salarios mínimos o más: se le presta 10.000.000
    Se debe revisar la validez del préstamo.

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
52
53
54
55
56
57
58
59
60
program PrestamosDeUnFondoDeEmpleados;
uses crt;

var antiguedad, cantidad_de_prestamos_pendientes, ingresos_comprobados, interes, prestamo : real;
var salario_minimo : real;
var tecla_repetir : char;
begin
    repeat
        clrscr;
        write ('Ingresa el valor de antiguedad: ');
        readln (antiguedad);
        write ('Ingresa el valor de cantidad de prestamos pendientes: ');
        readln (cantidad_de_prestamos_pendientes);
        write ('Ingresa el valor de ingresos comprobados: ');
        readln (ingresos_comprobados);
        write ('Ingresa el valor de salario minimo: ');
        readln (salario_minimo);
        prestamo := 0;
        if (ingresos_comprobados>=salario_minimo) and (ingresos_comprobados<salario_minimo*2) then
            begin
                prestamo := 3000000;
            end;
        if (ingresos_comprobados>=salario_minimo*2) and (ingresos_comprobados<salario_minimo*3) then
            begin
                prestamo := 5000000;
            end;
        if ingresos_comprobados>=salario_minimo*3 then
            begin
                prestamo := 10000000;
            end;
        if (cantidad_de_prestamos_pendientes>0) or (antiguedad<1) then
            begin
                prestamo := 0;
            end;
        interes := 0;
        if (antiguedad>=1) and (antiguedad<6) then
            begin
                interes := prestamo*0.03;
            end;
        if (antiguedad>=6) and (antiguedad<11) then
            begin
                interes := prestamo*0.02;
            end;
        if (antiguedad>=11) and (antiguedad<=15) then
            begin
                interes := prestamo*0.01;
            end;
        if prestamo=0 then
            begin
                writeln ('El pr'#130'stamo no es v'#160'lido');
            end;
        writeln ('Valor de interes: ', interes:0:6);
        writeln ('Valor de prestamo: ', prestamo:0:6);
        writeln;
        write (#168'Deseas repetir el proceso? (S/N): ');
        repeat
            tecla_repetir := readkey;
        until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
    until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
end.