• Lenguaje

    Pascal

  • Descripción

    Una empresa calcula el sueldo básico de sus trabajadores de acuerdo a las horas trabajadas,
    a la tarifa por hora que está dado de acuerdo a su categoría (P-Principal, A-Auxiliar, C-Contratado) y su profesión (T-Técnico, I-Ingeniero).
    El importe por hora se muestra en la siguiente tabla:
    Categoría | Ingeniero | Técnico
    Principal | 35 | 31
    Auxiliar | 30 | 27
    Contratado | 22 | 18

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
program SueldoPorCategoriaYProfesion;
uses crt;

var categoria, horas_trabajadas, profesion, sueldo_basico, tarifa : integer;
begin
    write ('Ingresa el valor de horas trabajadas: ');
    readln (horas_trabajadas);
    writeln ('Selecciona el valor de categoria.');
    writeln ('    1.- P-Principal');
    writeln ('    2.- A-Auxiliar');
    writeln ('    3.- C-Contratado');
    write ('    : ');
    repeat
        readln (categoria);
        if (categoria<1) or (categoria>3) then
            write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
    until (categoria>=1) and (categoria<=3);
    writeln ('Selecciona el valor de profesion.');
    writeln ('    1.- T-T'#130'cnico');
    writeln ('    2.- I-Ingeniero');
    write ('    : ');
    repeat
        readln (profesion);
        if (profesion<1) or (profesion>2) then
            write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
    until (profesion>=1) and (profesion<=2);
    tarifa := 0;
    if (categoria=1) and (profesion=2) then
        begin
            tarifa := 35;
        end;
    if (categoria=1) and (profesion=1) then
        begin
            tarifa := 31;
        end;
    if (categoria=2) and (profesion=2) then
        begin
            tarifa := 30;
        end;
    if (categoria=2) and (profesion=1) then
        begin
            tarifa := 27;
        end;
    if (categoria=3) and (profesion=2) then
        begin
            tarifa := 22;
        end;
    if (categoria=3) and (profesion=1) then
        begin
            tarifa := 18;
        end;
    sueldo_basico := horas_trabajadas*tarifa;
    writeln ('Valor de sueldo basico: ', sueldo_basico);
    writeln ('Valor de tarifa: ', tarifa);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.