-
Lenguaje
Pascal
-
Descripción
La utilidad que un trabajador recibe en el reparto anual de la empresa NNN se asigna como porcentaje de su salario mensual, el que depende de la antigüedad de 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.
Permita determinar el monto de dinero que la empresa debe pagar a n trabajadores por reparto de utilidades donde n es un valor ingresado por el usuario.
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
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
program RepartoAnualDeUtilidades2;
uses crt;
var i, n : integer;
var antiguedad, pago, salario, utilidad : real;
begin
write ('Ingresa el valor de n: ');
readln (n);
for i:=1 to n do
begin
writeln ('PROCESO ', i);
write ('Ingresa el valor de antiguedad: ');
readln (antiguedad);
write ('Ingresa el valor de salario: ');
readln (salario);
utilidad := 0;
if antiguedad<1 then
begin
utilidad := 0.05*salario;
end;
if (antiguedad>=1) and (antiguedad<2) then
begin
utilidad := 0.07*salario;
end;
if (antiguedad>=2) and (antiguedad<5) then
begin
utilidad := 0.1*salario;
end;
if (antiguedad>=5) and (antiguedad<10) then
begin
utilidad := 0.15*salario;
end;
if antiguedad>=10 then
begin
utilidad := 0.2*salario;
end;
pago := salario+utilidad;
writeln ('Valor de pago: ', pago:0:6);
writeln ('Valor de utilidad: ', utilidad:0:6);
writeln;
end;
end.
uses crt;
var i, n : integer;
var antiguedad, pago, salario, utilidad : real;
begin
write ('Ingresa el valor de n: ');
readln (n);
for i:=1 to n do
begin
writeln ('PROCESO ', i);
write ('Ingresa el valor de antiguedad: ');
readln (antiguedad);
write ('Ingresa el valor de salario: ');
readln (salario);
utilidad := 0;
if antiguedad<1 then
begin
utilidad := 0.05*salario;
end;
if (antiguedad>=1) and (antiguedad<2) then
begin
utilidad := 0.07*salario;
end;
if (antiguedad>=2) and (antiguedad<5) then
begin
utilidad := 0.1*salario;
end;
if (antiguedad>=5) and (antiguedad<10) then
begin
utilidad := 0.15*salario;
end;
if antiguedad>=10 then
begin
utilidad := 0.2*salario;
end;
pago := salario+utilidad;
writeln ('Valor de pago: ', pago:0:6);
writeln ('Valor de utilidad: ', utilidad:0:6);
writeln;
end;
end.