Pascal/Turbo Pascal - SOBRE ESTRUCTURA REPETITIVA WHILE

 
Vista:

SOBRE ESTRUCTURA REPETITIVA WHILE

Publicado por diaz (8 intervenciones) el 03/09/2013 23:20:14
amigo tengo esto ejercicio si me puede ayudar un poco gracias:
1) Una compañía de seguros tiene contratados a n vendedores. Cada uno hace tres ventas a la semana. Su política de pagos es que un vendedor recibe un sueldo base, y un 10% extra por comisiones de sus ventas. El gerente de su compañía desea saber cuanto dinero obtendrá en la semana cada vendedor por concepto de comisiones por las tres ventas realizadas, y cuanto tomando en cuenta su sueldo base y sus comisiones.

2) En una empresa se requiere calcular el salario semanal de cada uno de los n obreros que laboran en ella. El salario se obtiene de la sig. forma:
Si el obrero trabaja 40 horas o menos se le paga $20 por hora
Si trabaja mas de 40 horas se le paga $20 por cada una de las primeras 40 horas y $25 por cada hora extra.

3) Determinar cuantos hombres y cuantas mujeres se encuentran en un grupo de n personas, suponiendo que los datos son extraídos alumno por alumno.

4) El Depto. de Seguridad Publica y Transito del D.F. desea saber, de los n autos que entran a la ciudad de México, cuantos entran con calcomanía de cada color. Conociendo el ultimo dígito de la placa de cada automóvil se puede determinar el color de la calcomanía utilizando la sig. relación:

DÍGITO COLOR
1 o 2 amarilla
3 o 4 rosa
5 o 6 roja
7 o 8 verde
9 o 0 azul

5) Obtener el promedio de calificaciones de un grupo de n alumnos.

6) Una persona desea invertir su dinero en un banco, el cual le otorga un 2% de interés. Cual será la cantidad de dinero que esta persona tendrá al cabo de un año si la ganancia de cada mes es reinvertida?.

7) Calcular el promedio de edades de hombres, mujeres y de todo un grupo de alumnos.

8) En un supermercado un cajero captura los precios de los artículos que los clientes compran e indica a cada cliente cual es el monto de lo que deben pagar. Al final del día le indica a su supervisor cuanto fue lo que cobro en total a todos los clientes que pasaron por su caja.
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

SOBRE ESTRUCTURA REPETITIVA WHILE

Publicado por ramon (2158 intervenciones) el 05/09/2013 20:20:27
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
{Te mande esto al otro lado para ayudarte el tiempo es corto y hay mas cosas que hacer}
 
 program variostemas;
  uses
     crt;
   const
      numemp = 3;
      comis : integer = 10;
      numvent = 3;
      amarilla : integer = 0;
          rosa : integer = 0;
          roja : integer = 0;
         verde : integer = 0;
          azul : integer = 0;
 
    type
       salario = record
             sueldo : real;
             vent   : array[1..numvent] of real;
             extra  : real;
             total  : real;
           end;
 
       alumnos = record
            nombre : string[40];
            xeso   : char;
            clase  : char;
          end;
 
   var
     vendedores : array[1..numemp] of salario;
     obreros : array[1..numemp] of real;
     alum : array[1..numemp] of alumnos;
     autos : array[1..numemp] of longint;
 
  procedure losvendedores;
  var
     k, t : integer;
 
  begin
      clrscr;
      writeln('**** Compa¤ia De Seguros ****');
      writeln;
      t := 0;
    while t < numemp do
    begin
           write('    Entre El Sueldo Vendedor Num ',t + 1,' : ');
           readln(vendedores[t + 1].sueldo);
           write('    Entre Venta 1 : ');
           readln(vendedores[t + 1].vent[1]);
           write('    Entre Venta 2 : ');
           readln(vendedores[t + 1].vent[2]);
           write('    Entre Venta 3 : ');
           readln(vendedores[t + 1].vent[3]);
           vendedores[t + 1].extra := (((vendedores[t + 1].vent[1] +
                                vendedores[t + 1].vent[2] +
                                vendedores[t + 1].vent[3]) * comis) / 100);
          vendedores[t + 1].total := (vendedores[t + 1].sueldo +
                                   vendedores[t + 1].extra);
         t := t + 1;
         clrscr;
    end;
      clrscr;
      writeln('Sueldo    Importe 1  Importe 2  Importe 3   Comis.    Total');
      for k := 1 to numemp do
      begin
         with vendedores[k] do
         begin
         write(sueldo:0:2,'      ',vent[1]:0:2,'     ',vent[2]:0:2,
         '     ',vent[3]:0:2,'     ',extra:0:2,'     ',total:0:2);
         end;
         writeln;
      end;
  end;
 
  procedure sueldosobreros;
  var
    horas : array[1..numemp] of integer;
    t : integer;
    resto : real;
   begin
      t := 0;
      while t < numemp do
      begin
         clrscr;
         writeln(' Empleado Num ',t + 1);
         write('   Entre Haras Trabajadas : ');
         readln(horas[t + 1]);
         if horas[t + 1] > 40 then
         begin
            resto := (horas[t + 1] - 40) * 25;
            obreros[t + 1] := (40 * 20) + resto;
         end
       else
          begin
             obreros[t + 1] := horas[t + 1] * 20;
          end;
         t := t + 1;
      end;
        for t := 1 to numemp do
        writeln('   Empleado Num ',t,'   Sueldo = ',obreros[t]:0:2);
   end;
 
   procedure estudianter;
   var
     tec : char;
     fem, mas, t : integer;
 
   begin
       t := 0;
     while t < numemp do
     begin
       clrscr;
       writeln('***** Datos Estudiante Num ',t + 1);
       writeln;
       write('   Entre Nombre : ');
       readln(alum[t + 1].nombre);
       write(' Entre [F]=Femenino [M]=Masculino ');
       repeat
          tec := upcase(readkey);
       until tec in['F','M'];
       alum[t + 1].xeso := tec;
       writeln;
       write(' Entre Clase [A/B/C/D ');
       repeat
          tec := upcase(readkey);
       until tec in['A','B','C','D'];
       alum[t + 1].clase := tec;
       t := t + 1;
     end;
       clrscr;
       writeln('***** Alumnos Femeninos Y Masculinos *****');
       writeln;
       fem := 0;
       mas := 0;
       for t := 1 to numemp do
       begin
          if alum[t].xeso = 'F' then
          fem := fem + 1;
          if alum[t].xeso = 'M' then
          mas := mas + 1;
       end;
         writeln('   Masculinos = ',mas);
         writeln('   Femeninos  = ',fem);
   end;
 
  procedure automoviles;
  var
     t : integer;
     num : string;
   begin
       t := 0;
       while t < numemp do
       begin
       clrscr;
       writeln('***** Autos Determinar El Color ****');
       writeln;
       write('   Entre Matricula Auto Num ',t + 1,' : ');
       readln(autos[t + 1]);
       t := t + 1;
      end;
       for t := 1 to numemp do
       begin
           str(autos[t],num);
           case num[length(num)] of
      '1','2' : amarilla := amarilla + 1;
      '3','4' : rosa := rosa + 1;
      '5','6' : roja := roja + 1;
      '7','8' : verde := verde + 1;
      '9','0' : azul := azul + 1;
          end;
       end;
       clrscr;
       writeln('****** Numero Autos Por Color ******');
       writeln;
       writeln('   Amarilla = ',amarilla);
       writeln('   Rosa     = ',rosa);
       writeln('   Roja     = ',roja);
       writeln('   Verde    = ',verde);
       writeln('   Azul     = ',Azul);
   end;
 
   procedure menu;
   var
      tl : char;
      sal : boolean;
   begin
        sal := false;
     repeat
         clrscr;
         writeln('****** Menu Jeneral ******');
         writeln;
         writeln('     1 = Vendedores');
         writeln('     2 = Sueldos');
         writeln('     3 = Estudiantes');
         writeln('     4 = Autos');
         writeln('     5 = Salir');
         writeln;
         writeln('<<<<< Elija Opcion >>>>>');
         repeat
              tl := readkey;
         until tl in['1','2','3','4','5'];
         clrscr;
     case tl of
  '1' : begin losvendedores; readkey; end;
  '2' : begin sueldosobreros; readkey; end;
  '3' : begin estudianter; readkey; end;
  '4' : begin automoviles; readkey; end;
  '5' : sal := true;
    end;
   until sal = true;
 end;
 
 
  begin
      clrscr;
      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

SOBRE ESTRUCTURA REPETITIVA WHILE

Publicado por ramon (2158 intervenciones) el 05/09/2013 22:06:50
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
{Otras mas}
 
 procedure calificaciones;
   var
     alu : array[1..numemp] of real;
     t : integer;
     total, media : real;
    begin
       t := 0;
       while t < numemp do
       begin
          clrscr;
          writeln('**** Calculo Media ****');
          writeln;
          write(' Entre Calificacion Alumno Num ',t + 1,' : ');
          readln(alu[t + 1]);
          t := t + 1;
       end;
         total := 0;
         for t := 1 to numemp do
         total := total + alu[t];
         media := total / numemp;
         clrscr;
         writeln('  La Media es : ',media:0:2);
    end;
 
    procedure banco;
    var
      capital : real;
      interes : real;
      sumas : real;
      total : real;
      t : integer;
    begin
       clrscr;
       writeln('**** Calculo De Interes ****');
       writeln;
       write('   Entre Capital Inicial : ');
       readln(capital);
       total := capital;
       sumas := 0.0;
       for t := 1 to 12 do
       begin
       interes := (total * 2 / 100) / 12;
       sumas := sumas + interes;
       total := total + interes;
       end;
         clrscr;
         writeln('**** Resultados ****');
         writeln;
         writeln('   Capital Inicial        : ',capital:0:2);
         writeln('   Interes Anual          : ',sumas:0:2);
         writeln('   Total Interes Capital  : ',total:0:2);
    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

SOBRE ESTRUCTURA REPETITIVA WHILE

Publicado por ramon (2158 intervenciones) el 05/09/2013 23:10: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
{Y todo espero te sirva de ayuda}
 
procedure promedioedades;
   var
     lumno : array[1..numemp] of integer;
     t : integer;
     media, todas : real;
     begin
        clrscr;
        writeln('**** Promedio De Edades ****');
        t := 0;
        while t < numemp do
        begin
          clrscr;
          write('   Entre Edad Alumno Num ',t + 1,' : ');
          readln(lumno[t + 1]);
          t := t + 1;
        end;
          todas := 0.0;
          media := 0.0;
          for t := 1 to numemp do
          todas := todas + lumno[t];
          media := todas / numemp;
          clrscr;
          writeln('  La Edad Media Es : ',media:0:2);
     end;
 
   procedure supermercado;
   var
     articulos : array[1..numemp,1..numvent] of real;
     k, t : integer;
     clitot, total : real;
    begin
       t := 0;
      while t < numemp do
      begin
         k := 0;
         clitot := 0.0;
         while k < numvent do
         begin
            clrscr;
            writeln('  Cliente Num  ',t + 1);
            writeln;
            write(' Entre Precio Articulo Num ',k + 1,' : ');
            readln(articulos[t + 1,k + 1]);
            clitot := clitot + articulos[t + 1,k + 1];
            k := k + 1;
         end;
         writeln('  El Importe Es = ',clitot:0:2);
         writeln('    Pulse Una Tecla');
         readkey;
         t := t + 1;
      end;
        total := 0.0;
        for t := 1 to numemp do
          for k := 1 to numvent do
          begin
          total := total + articulos[t,k];
          end;
          clrscr;
          writeln('  El Total De Ventas Es : ',total:0:2);
    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
sin imagen de perfil

SOBRE ESTRUCTURA REPETITIVA WHILE

Publicado por fer (8 intervenciones) el 06/09/2013 04:30:03
muchas gracias amigo
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

SOBRE ESTRUCTURA REPETITIVA WHILE

Publicado por fercho (8 intervenciones) el 06/09/2013 21:11:18
IGUAL MENTE ESTE como lo borro amigo
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

SOBRE ESTRUCTURA REPETITIVA WHILE

Publicado por ramon (2158 intervenciones) el 06/09/2013 21:23:15
Como borras el que sino quieres mostrar información quita los writes que hay.
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
sin imagen de perfil

SOBRE ESTRUCTURA REPETITIVA WHILE

Publicado por fercho (8 intervenciones) el 06/09/2013 21:44:26
nada no medeja quitar eso while . yde borra ps digo yo ose la pregunta lo cometario
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