Pascal/Turbo Pascal - Ayuda Ugente. Codificación

 
Vista:
Imágen de perfil de Leo G.

Ayuda Ugente. Codificación

Publicado por Leo G. (11 intervenciones) el 23/11/2014 17:01:45
Hola! Sera que me pueden ayudar a codificar el siguiente programa que no lo logro a realizar.

Se tiene un archivo secuencial con los datos de los empleados de una empresa con los siguientes campos:
legajo, nombre y apellido, domicilio, fecha de ingreso, sueldo.


Se pide obtener a partir de este array un listado con los montos a pagar a los empleados calculando el incremento según años de antigüedad del siguiente modo:


0% del sueldo para antigüedad menor a un año

5% para antigüedad entre 1 y 3 años

10% para antigüedad entre 4 y 6 años

20% para antigüedad mayor a 6 años.

Desde ya muchas gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

Ayuda Ugente. Codificación

Publicado por Rene Gar (58 intervenciones) el 25/11/2014 04:10:03
Te aconsejaría que intentaras hacerlo porque tu problema es muy sencillo avanza un poco y si te trabas avisanos para poder ayudarte no creas que vamos a hacer tu tarea
ha no ser que venga el amigo ramon y te lo haga ya que el es muy buena gente pero en realidad intenta hacerlo es muy facil

solo necesitas lo basico espero no te ofendas saludos.....
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar

Ayuda Ugente. Codificación

Publicado por ramon (2158 intervenciones) el 25/11/2014 23:58:26
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
{A ver espero esto te hayude }
 
 program empleados;
  uses
     crt, dos;
  const
     antiguedad : array[1..4] of integer = (0,5,10,20);
     archi = 'salarios.dat';
 
  type
     emplea = record
      legajo : longint;
      nombre : string[80];
    apellido : string[80];
   domicilio : string[100];
       fecha : string[12];
      sueldo : real;
       end;
 
   var
     f : file of emplea;
     datos : emplea;
     almes : real;
     lega : longint;
     encont : boolean;
 
 
   procedure salvardatos(d : emplea);
   begin
      assign(f,archi);
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
      rewrite(f);
      seek(f,0);
      write(f,d);
      close(f);
   end
 else
    begin
       seek(f,filesize(f));
       write(f,d);
       close(f);
    end;
   end;
 
   procedure entradadedatos;
   var
     tec : char;
   begin
      clrscr;
      writeln('  **** Entrada Datos Empleados ****');
      writeln('  ---------------------------------');
      writeln;
      write('   Entra Legajo        : ');
      readln(datos.legajo);
      write('   Entra Nombre        : ');
      readln(datos.nombre);
      write('   Entra Apellido      : ');
      readln(datos.apellido);
      write('   Entra Domicilio     : ');
      readln(datos.domicilio);
      write('   Entra Fecha Ingreso [dia/mes/a¤o] : ');
      readln(datos.fecha);
      write('   Entra Salario       : ');
      readln(datos.sueldo);
      writeln;
      writeln('   >>>>> Datos Correctos [S/N] <<<<<<');
      repeat
         tec := upcase(readkey);
      until tec in['S','N'];
      if tec = 'S' then
      salvardatos(datos)
    else
      entradadedatos;
   end;
 
   function calculosueldo(s : longint) : real;
   var
      salar : emplea;
      fechaact : string[12];
      aa, mm, dd : string[4];
      ayo, mes, dia, diasem : Word;
      saa, rra : word;
      erro : integer;
      j : longint;
   begin
      calculosueldo := 0.0;
      fillchar(datos,sizeof(emplea),0);
      fillchar(salar,sizeof(salar),0);
      getdate(ayo,mes,dia,diasem);
      str(dia,dd);
      str(mes,mm);
      str(ayo,aa);
      fechaact := dd + '/' + mm + '/' + aa;
      encont := false;
      assign(f,archi);
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
      writeln('   ???? Error De Archivo O No Existe Pulse Una Tecla ????');
      readkey;
   end
 else
    begin
       for j := 0 to filesize(f) - 1 do
       begin
           seek(f,j);
           read(f,salar);
           if salar.legajo = s then
           begin
              saa := 0;
              rra := 0;
              encont := true;
              val(aa,saa,erro);
              if erro <> 0 then
              begin
                delete(aa,erro,1);
                val(aa,saa,erro);
              end;
     mm := copy(salar.fecha,length(salar.fecha) - 3,length(salar.fecha));
     val(mm,rra,erro);
     if erro <> 0 then
     begin
     delete(mm,erro,1);
     val(mm,rra,erro);
     end;
      encont := true;
      datos := salar;
      close(f);
      break;
   end;
  end;
     if encont = true then
     begin
       if (saa - rra) < 1 then
       calculosueldo := salar.sueldo;
       if (saa - rra) in[1..3] then
       calculosueldo := salar.sueldo + ((salar.sueldo * antiguedad[2]) / 100);
       if (saa - rra) in[4..6] then
       calculosueldo := salar.sueldo + ((salar.sueldo * antiguedad[3]) / 100);
       if (saa - rra) > 6 then
       calculosueldo := salar.sueldo + ((salar.sueldo * antiguedad[4]) / 100);
     end
  else
     begin
       writeln;
       writeln('  Error Legajo No Encontrado Pulse Una Tecla');
       readkey;
     end;
    end;
   end;
 
   procedure menu;
   var
      sal : boolean;
      te : char;
   begin
      sal := false;
      repeat
         clrscr;
         writeln('       ***** Menu Jeneral *****   ');
         writeln;
         writeln('   1 = Entrada Tabajador');
         writeln('   2 = Salario Trabajador');
         writeln('   3 = Salir');
         writeln;
         writeln('       >>>>> Elija Opcion <<<<< ');
       repeat
           te := readkey;
       until te in['1','2','3'];
       clrscr;
     case te of
  '1' : entradadedatos;
  '2' : begin
          lega := 0;
          write('   Entre Legajo : ');
          readln(lega);
          writeln('  ***** Los Resultados Son *****');
          writeln;
          almes := calculosueldo(lega);
          if encont = true then
          begin
          writeln('  Nombre : ',datos.nombre);
          writeln('  Apellido : ',datos.apellido);
          writeln('  Fecha Ingreso : ',datos.fecha);
          writeln('  Salario : ',datos.sueldo:0:2);
          writeln('  El Salario Total Es = ',almes:0:2);
          readkey;
        end;
      end;
  '3' : sal := true;
    end;
      until sal = true;
   end;
 
 
 
   begin
      menu;
   end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar