-
Lenguaje
Pascal
-
Descripción
En una microempresa a los trabajadores le pagan según sus horas trabajadas y la tarifa está a un valor por hora y por su antigüedad. Si la cantidad de horas trabajadas es mayor a 40 horas, la tarifa por hora se incrementa en un 50% para las horas extras y si su tiempo de antigüedad en 2 a 5 años. Pero si tiene entre 6 a 10 años recibira un bono adicional de de 20% . Calcular el salario del trabajador dadas las horas trabajadas y la tarifa. Genere opciones según la cantidad de horas. Genere una opción en base al ejercicio anterior para obtener la suma de los salarios de todos los trabajadores.
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
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
program SalariosEnUnaMicroempresa;
uses crt;
var antiguedad, horas_trabajadas, salario, suma, tarifa : real;
var tecla_repetir : char;
begin
suma := 0;
repeat
clrscr;
write ('Ingresa el valor de antiguedad: ');
readln (antiguedad);
write ('Ingresa el valor de horas trabajadas: ');
readln (horas_trabajadas);
write ('Ingresa el valor de tarifa: ');
readln (tarifa);
salario := tarifa*horas_trabajadas;
if (horas_trabajadas>40) and (antiguedad>=2) and (antiguedad<=5) then
begin
salario := salario+tarifa*(horas_trabajadas-40)*0.5;
end;
if (antiguedad>=6) and (antiguedad<=10) then
begin
salario := salario*1.2;
end;
suma := suma+salario;
writeln ('Valor de salario: ', salario: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');
writeln ('Valor de suma: ', suma:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var antiguedad, horas_trabajadas, salario, suma, tarifa : real;
var tecla_repetir : char;
begin
suma := 0;
repeat
clrscr;
write ('Ingresa el valor de antiguedad: ');
readln (antiguedad);
write ('Ingresa el valor de horas trabajadas: ');
readln (horas_trabajadas);
write ('Ingresa el valor de tarifa: ');
readln (tarifa);
salario := tarifa*horas_trabajadas;
if (horas_trabajadas>40) and (antiguedad>=2) and (antiguedad<=5) then
begin
salario := salario+tarifa*(horas_trabajadas-40)*0.5;
end;
if (antiguedad>=6) and (antiguedad<=10) then
begin
salario := salario*1.2;
end;
suma := suma+salario;
writeln ('Valor de salario: ', salario: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');
writeln ('Valor de suma: ', suma:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.