-
Lenguaje
Pascal
-
Descripción
Calcular la utilidad que un trabajador recibe del reparto anual de utilidades si éste se le asigna como un porcentaje de su salario mensual que depende de su antigüedad en la empresa, de acuerdo con la siguiente tabla:
Tiempo | Utilidad
Menos de 1 año | 5% del salario
1 año o más y menos de 2 años | 7% del salario
2 años o más y menos de 5 años | 10% del salario
5 años o más y menos de 10 años | 15% del salario
10 años | 20% del salario.
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
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
program RepartoAnualDeUtilidades;
uses crt;
var antiguedad, salario, utilidades : real;
begin
write ('Ingresa el valor de antiguedad: ');
readln (antiguedad);
write ('Ingresa el valor de salario: ');
readln (salario);
utilidades := 0;
if antiguedad<1 then
begin
utilidades := 0.05*salario;
end;
if (antiguedad>=1) and (antiguedad<2) then
begin
utilidades := 0.07*salario;
end;
if (antiguedad>=2) and (antiguedad<5) then
begin
utilidades := 0.1*salario;
end;
if (antiguedad>=5) and (antiguedad<10) then
begin
utilidades := 0.15*salario;
end;
if antiguedad>=10 then
begin
utilidades := 0.2*salario;
end;
writeln ('Valor de utilidades: ', utilidades:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var antiguedad, salario, utilidades : real;
begin
write ('Ingresa el valor de antiguedad: ');
readln (antiguedad);
write ('Ingresa el valor de salario: ');
readln (salario);
utilidades := 0;
if antiguedad<1 then
begin
utilidades := 0.05*salario;
end;
if (antiguedad>=1) and (antiguedad<2) then
begin
utilidades := 0.07*salario;
end;
if (antiguedad>=2) and (antiguedad<5) then
begin
utilidades := 0.1*salario;
end;
if (antiguedad>=5) and (antiguedad<10) then
begin
utilidades := 0.15*salario;
end;
if antiguedad>=10 then
begin
utilidades := 0.2*salario;
end;
writeln ('Valor de utilidades: ', utilidades:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.