Pascal/Turbo Pascal - Urgente ayuda

 
Vista:

Urgente ayuda

Publicado por Carlos (1 intervención) el 10/07/2012 20:07:43
Buenas tardes necesito saber si alguien tiene el codigo fuente en PASCAL que calcule el sueldo de N trabajadores de un empresa con CASE.

1 Obrero. Sueldo=Nº Horas x Valor de Horas + Bono Obrero

2 Empleado. Sueldo 0 Nº Dias x Valor Diario

3 Gerente. Sueldo = Sueldo gerencial.

E imprimir el sueldo a cobrar. De verdad no lo entiendo. Ayudenme porfa.
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

Urgente ayuda

Publicado por ramon (2158 intervenciones) el 11/07/2012 16:43:23
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
{Espero esto te sirva}
 
program sueldos;
  uses
    crt;
  type
   obrero = record
          nhoras : integer;
          precio : real;
          bono   : real;
        end;
 
   empleado = record
            ndias : integer;
            precio : real;
          end;
 
   gerente = record
           sueldo : real;
          end;
 
  var
     obrer : obrero;
     emple : empleado;
     geren : gerente;
 
 
  procedure entradadatos;
  begin
      clrscr;
      writeln('Datos del Obrero');
      writeln;
      write('N§ Horas : ');
      readln(obrer.nhoras);
      write('Precio Hora : ');
      readln(obrer.precio);
      write('Bono Impot : ');
      readln(obrer.bono);
      clrscr;
      writeln('Datos Empleado');
      writeln;
      write('N§ Dias : ');
      readln(emple.ndias);
      write('Precio Dia : ');
      readln(emple.precio);
      clrscr;
      writeln('Datos Gerente');
      writeln;
      write('Sueldo : ');
      readln(geren.sueldo);
      clrscr;
   end;
 
  begin
    entradadatos;
    writeln('El Obrero Cobra   = ',(obrer.nhoras * obrer.precio) +
                                         obrer.bono:8:2,' Euro');
    writeln('El Empleado Cobra = ',(emple.ndias * emple.precio):8:2,' Euro');
    writeln('El Gerente Cobra  = ',geren.sueldo:8:2,' Euro');
    writeln;
    writeln('<< Pulse [Enter] >>');
    readln;
  end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 36
Ha aumentado su posición en 4 puestos en Pascal/Turbo Pascal (en relación al último mes)
Gráfica de Pascal/Turbo Pascal

Urgente ayuda

Publicado por Armando Fuenmayor (43 intervenciones) el 16/07/2012 22:46:51
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
program empresa(input,output);
uses crt;
  type
     matriobrero = record
           tipo              : integer   ;
           Ape_y_Nombre      : String[18];
           numhoras          : Integer   ;
           valor_horas       : real      ;
           bono_obrero       : real      ;
           sueldototal       : real      ;
           num_dias_emple    : integer   ;
           val_diario_emple  : real      ;
           sue_gerente       : real      ;
         end;
            Aobre = array[1..100] of matriobrero  ;
 var
 conobre, conpemple, congeren, n , i : Integer;
   suel : real;
   xx: Aobre;
   ch : char;
(************************************************)
(* FUNCION QUE CONVIERTE UNA CADENA A MAYUSCULA *)
(************************************************)
function UpCaseStr(S: string): string;
var
  jj: Integer;
begin
  for jj := 1 to Length(S) do
  if (S[jj] >= 'a') and (S[jj] <= 'z') then
  Dec(S[jj], 32);
  UpCaseStr := S;
end;
     procedure obre;
     begin
        gotoxy(28,10);
        writeln('                              ');
        gotoxy(2,10);
        writeln('Apellido y Nombre N§ : ', i , ' = ' ) ;
        gotoxy(29,10);
        readln(xx[i].Ape_y_Nombre) ;
        clreol;
          writeln('           ') ;
 
          gotoxy(2,12);
          writeln('Numeros de horas: ', i ,' = ') ;
 
          gotoxy(26,12);
          readln(xx[i].numhoras) ;
          clreol;
 
          gotoxy(2,14);
          writeln('Valor de la hora: ', i ,' = ') ;
 
          gotoxy(26,14);
          readln(xx[i].valor_horas) ;
          clreol;
 
          gotoxy(2,16);
          writeln('Bono del obrero: ', i ,' = ') ;
 
          gotoxy(26,16);
          readln(xx[i].bono_obrero) ;
          clreol;
 
          suel :=  0.0 ;
          suel :=  (xx[i].numhoras * xx[i].valor_horas) + xx[i].bono_obrero;
             xx[i].sueldototal := suel ;
             xx[i].tipo := 1  ;
end;
(*******)
     procedure empleado;
     begin
        gotoxy(28,10);
        writeln('                              ');
        gotoxy(2,10);
        writeln('Apellido y Nombre N§ : ', i , ' = ' ) ;
        gotoxy(29,10);
        readln(xx[i].Ape_y_Nombre) ;
        clreol;
          writeln('           ') ;
 
          gotoxy(2,12);
          writeln('Numeros de dias : ', i ,' = ') ;
 
          gotoxy(26,12);
          readln(xx[i].num_dias_emple) ;
          clreol;
 
          gotoxy(2,14);
          writeln('Valor diario    : ', i ,' = ') ;
 
          gotoxy(26,14);
          readln(xx[i].val_diario_emple) ;
          clreol;
 
          suel :=  0.0 ;
          suel :=  (xx[i].num_dias_emple * xx[i].val_diario_emple) ;
             xx[i].sueldototal := suel ;
             xx[i].tipo := 2  ;
end;
 
(************)
(* Mostrar  *)
(************)
procedure mosobrero;
begin
  clrscr;
  gotoxy(3,2);
  write('personal obrero ');
  gotoxy(3,4);
  write('Nombres         :Horas  :Valor H.  :Bono Obrero :Sueldo ');
     for i := 1 to N do
     begin
            IF (xx[i].TIPO = 1 ) THEN
            BEGIN
         gotoxy(1,5+i);
         write(UpCaseStr(xx[i].Ape_y_Nombre));
         gotoxy(20,5+i);
         write(xx[i].numhoras) ;
        gotoxy(27,5+i);
         write(xx[i].valor_horas:5:2) ;
 
         gotoxy(38,5+i);
         write(xx[i].bono_obrero:5:2) ;
 
         gotoxy(48,5+i);
         write(xx[i].sueldototal:5:2)
     end;
  END;
end;
 
 
     procedure gerente;
     begin
        gotoxy(28,10);
        writeln('                              ');
        gotoxy(2,10);
        writeln('Apellido y Nombre N§ : ', i , ' = ' ) ;
        gotoxy(29,10);
        readln(xx[i].Ape_y_Nombre) ;
        clreol;
          writeln('           ') ;
 
          gotoxy(2,12);
          writeln('sueldo del gerente', i ,' = ') ;
 
          gotoxy(26,12);
          readln(xx[i].sueldototal) ;
          clreol;
 
 
             xx[i].tipo := 3  ;
end;
 
 
 
 
(** mas empleado **)
procedure mosmpleado;
begin
  writeln;
  writeln('Empleados ');
  write('Nombres         :Horas  :Valor H.  Sueldo ');
     for i := 1 to N do
     begin
           IF (xx[i].TIPO = 2 ) THEN
            BEGIN
 
         gotoxy(1,5+i+conobre);
         write(UpCaseStr(xx[i].Ape_y_Nombre));
         gotoxy(20,5+i+conobre);
         write(xx[i].num_dias_emple) ;
        gotoxy(27,5+i+conobre);
         write(xx[i].val_diario_emple:5:2) ;
 
         gotoxy(38,5+i+conobre);
         write(xx[i].sueldototal:5:2) ;
 
     end;
   END;
end;
 
 
 
procedure mosgerente;
begin
  writeln;
  writeln('Gerentes ');
  writeln('Nombres        Sueldo ');
     for i := 1 to N do
     begin
           IF (xx[i].TIPO = 3 ) THEN
            BEGIN
 
         gotoxy(1,5+i+conobre+conpemple+congeren);
         write(UpCaseStr(xx[i].Ape_y_Nombre));
 
         gotoxy(20,5+i+conobre+conpemple+congeren);
         write(xx[i].sueldototal:5:2) ;
 
 
     end;
   END;
end;
 
begin
      clrscr;
       conobre := 0;
       conpemple := 0;
       congeren := 0;
 
        gotoxy(2,5);
        writeln('Cantidad de Personasl: ' ) ;
        gotoxy(25,5);
        readln(n) ;
 
      for i := 1 to n do
      begin
         clrscr;
        gotoxy(2,6);
        writeln('Que tipo es [O/E/G]: ' ) ;
        gotoxy(25,6);
         Ch  := upcase(readkey);
       case Ch of
      'O' : begin
              WriteLn('Obrero ');
              inc(conobre) ;
              obre;
          end;
      'E' : begin
           WriteLn('Empleado ');
           inc(conpemple);
                empleado;
      end;
      'G' : begin
              WriteLn('Gerente  ');
            inc(congeren);
             gerente;
 
     end;
  end;
        end;
 
        mosobrero;
        mosmpleado;
        mosgerente;
  readln;
 
end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar