-
Lenguaje
Pascal
-
Descripción
Determinar el monto que recibirá un trabajador por utilidades, después de ingresar el tiempo de servicio y el cargo, según la siguiente tabla.
Tiempo de serv. | Administrador | Contador | Empleado
Entre 0 y 2 años | 2000 | 1500 | 1000
Entre 3 y 5 años | 2500 | 2000 | 1500
Entre 6 y 8 años | 3000 | 2500 | 2000
Mayor a 8 años | 4000 | 3500 | 2500
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
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
program UtilidadesPorElTiempoDeServicioYElCargo;
uses crt;
var cargo, tiempo_de_servicio, utilidades : integer;
begin
write ('Ingresa el valor de tiempo de servicio: ');
readln (tiempo_de_servicio);
writeln ('Selecciona el valor de cargo.');
writeln (' 1.- Administrador');
writeln (' 2.- Contador');
writeln (' 3.- Empleado');
write (' : ');
repeat
readln (cargo);
if (cargo<1) or (cargo>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (cargo>=1) and (cargo<=3);
utilidades := 0;
if (cargo=1) and (tiempo_de_servicio<=2) then
begin
utilidades := 2000;
end;
if (cargo=1) and (tiempo_de_servicio>2) and (tiempo_de_servicio<=5) then
begin
utilidades := 2500;
end;
if (cargo=1) and (tiempo_de_servicio>5) and (tiempo_de_servicio<=8) then
begin
utilidades := 3000;
end;
if (cargo=1) and (tiempo_de_servicio>8) then
begin
utilidades := 4000;
end;
if (cargo=2) and (tiempo_de_servicio<=2) then
begin
utilidades := 1500;
end;
if (cargo=2) and (tiempo_de_servicio>2) and (tiempo_de_servicio<=5) then
begin
utilidades := 2000;
end;
if (cargo=2) and (tiempo_de_servicio>5) and (tiempo_de_servicio<=8) then
begin
utilidades := 2500;
end;
if (cargo=2) and (tiempo_de_servicio>8) then
begin
utilidades := 3500;
end;
if (cargo=3) and (tiempo_de_servicio<=2) then
begin
utilidades := 1000;
end;
if (cargo=3) and (tiempo_de_servicio>2) and (tiempo_de_servicio<=5) then
begin
utilidades := 1500;
end;
if (cargo=3) and (tiempo_de_servicio>5) and (tiempo_de_servicio<=8) then
begin
utilidades := 2000;
end;
if (cargo=3) and (tiempo_de_servicio>8) then
begin
utilidades := 2500;
end;
writeln ('Valor de utilidades: ', utilidades);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var cargo, tiempo_de_servicio, utilidades : integer;
begin
write ('Ingresa el valor de tiempo de servicio: ');
readln (tiempo_de_servicio);
writeln ('Selecciona el valor de cargo.');
writeln (' 1.- Administrador');
writeln (' 2.- Contador');
writeln (' 3.- Empleado');
write (' : ');
repeat
readln (cargo);
if (cargo<1) or (cargo>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (cargo>=1) and (cargo<=3);
utilidades := 0;
if (cargo=1) and (tiempo_de_servicio<=2) then
begin
utilidades := 2000;
end;
if (cargo=1) and (tiempo_de_servicio>2) and (tiempo_de_servicio<=5) then
begin
utilidades := 2500;
end;
if (cargo=1) and (tiempo_de_servicio>5) and (tiempo_de_servicio<=8) then
begin
utilidades := 3000;
end;
if (cargo=1) and (tiempo_de_servicio>8) then
begin
utilidades := 4000;
end;
if (cargo=2) and (tiempo_de_servicio<=2) then
begin
utilidades := 1500;
end;
if (cargo=2) and (tiempo_de_servicio>2) and (tiempo_de_servicio<=5) then
begin
utilidades := 2000;
end;
if (cargo=2) and (tiempo_de_servicio>5) and (tiempo_de_servicio<=8) then
begin
utilidades := 2500;
end;
if (cargo=2) and (tiempo_de_servicio>8) then
begin
utilidades := 3500;
end;
if (cargo=3) and (tiempo_de_servicio<=2) then
begin
utilidades := 1000;
end;
if (cargo=3) and (tiempo_de_servicio>2) and (tiempo_de_servicio<=5) then
begin
utilidades := 1500;
end;
if (cargo=3) and (tiempo_de_servicio>5) and (tiempo_de_servicio<=8) then
begin
utilidades := 2000;
end;
if (cargo=3) and (tiempo_de_servicio>8) then
begin
utilidades := 2500;
end;
writeln ('Valor de utilidades: ', utilidades);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.