• Lenguaje

    Pascal

  • Descripción

    Entrar por pantalla los datos de 30 pacientes: cédula, nombre, edad, sexo (1=mujer, 2=masculino), tipo de dolencia (1=bronquitis, 2=presión alta, 3=cáncer, 4=diabetes), estrato (1-6), y valor tratamiento.
    Se pide porcentaje de los hombres mayores de 50 años con cáncer.
    Total mujeres menores de edad con bronquitis o diabetes.
    Se pide mostrar el valor a pagar por cada paciente, el total recaudado por la EPS.

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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
program TotalRecaudadoPorLaEps;
uses crt;

var estrato, i, mujeres_menores_con_bronquitis_o_diabetes, sexo, tipo_de_dolencia : integer;
var edad, porcentaje_hombres_mayores_de_50_con_cancer, total_recaudado, tratamiento : real;
var cedula, nombre : string;
begin
    mujeres_menores_con_bronquitis_o_diabetes := 0;
    porcentaje_hombres_mayores_de_50_con_cancer := 0;
    total_recaudado := 0;
    for i:=1 to 30 do
    begin
        writeln ('PROCESO ', i);
        write ('Ingresa el cedula: ');
        readln (cedula);
        write ('Ingresa el nombre: ');
        readln (nombre);
        write ('Ingresa el valor de edad: ');
        readln (edad);
        write ('Ingresa el valor de tratamiento: ');
        readln (tratamiento);
        writeln ('Selecciona el valor de sexo.');
        writeln ('    1.- Mujer');
        writeln ('    2.- Masculino');
        write ('    : ');
        repeat
            readln (sexo);
            if (sexo<1) or (sexo>2) then
                write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
        until (sexo>=1) and (sexo<=2);
        writeln ('Selecciona el valor de tipo de dolencia.');
        writeln ('    1.- Bronquitis');
        writeln ('    2.- Presi'#162'n alta');
        writeln ('    3.- C'#160'ncer');
        writeln ('    4.- Diabetes');
        write ('    : ');
        repeat
            readln (tipo_de_dolencia);
            if (tipo_de_dolencia<1) or (tipo_de_dolencia>4) then
                write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
        until (tipo_de_dolencia>=1) and (tipo_de_dolencia<=4);
        writeln ('Selecciona el valor de estrato.');
        writeln ('    1.- Uno');
        writeln ('    2.- Dos');
        writeln ('    3.- Tres');
        writeln ('    4.- Cuatro');
        writeln ('    5.- Cinco');
        writeln ('    6.- Seis');
        write ('    : ');
        repeat
            readln (estrato);
            if (estrato<1) or (estrato>6) then
                write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
        until (estrato>=1) and (estrato<=6);
        if (edad>50) and (tipo_de_dolencia=3) then
            begin
                porcentaje_hombres_mayores_de_50_con_cancer := porcentaje_hombres_mayores_de_50_con_cancer+1;
            end;
        if (edad<18) and ((tipo_de_dolencia=1) or (tipo_de_dolencia=4)) then
            begin
                mujeres_menores_con_bronquitis_o_diabetes := mujeres_menores_con_bronquitis_o_diabetes+1;
            end;
        total_recaudado := total_recaudado+tratamiento;
        writeln ('Cedula: ', cedula);
        writeln ('Nombre: ', nombre);
        writeln;
    end;
    porcentaje_hombres_mayores_de_50_con_cancer := 10.0*porcentaje_hombres_mayores_de_50_con_cancer/3;
    writeln ('Valor de mujeres menores con bronquitis o diabetes: ', mujeres_menores_con_bronquitis_o_diabetes);
    writeln ('Valor de porcentaje hombres mayores de 50 con cancer: ', porcentaje_hombres_mayores_de_50_con_cancer:0:6);
    writeln ('Valor de total recaudado: ', total_recaudado:0:6);
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.