Pascal/Turbo Pascal - Ayuda Porfavor :S

 
Vista:

Ayuda Porfavor :S

Publicado por Octavio Perez (1 intervención) el 19/06/2014 02:25:06
La empresa MALLIN, es productora de dos tipos de mallas: mallas planas y malla en rollo. La alta gerencia, requiere controlar las ventas por día según las siguientes políticas:
- Si el cliente tiene más de cinco años como comprador de malla en rollo tendrá un descuento del 8%. Si es comprador de malla plana, tendrá un descuento del 6%.
- El cliente que tenga un tiempo menor o igual a cinco años no tendrá descuento.
El costo de la malla plana es de 400 Bsf.
El costo de la malla en rollo es de 520 Bsf.

Tomando en cuenta las políticas anteriores se desea determinar:

- El costo de la compra por cliente, es decir, el ingreso recibido por la empresa al realizarse la venta.
- Cantidad de malla plana vendida.
- Cantidad de malla en rollo vendida.
- Tipo de malla que más se vendió.
- Total de clientes que obtuvieron descuento
- Cantidad total de descuento.
- Total de compras.

Datos de entrada:
CODIGO DEL CLIENTE: XX-XXA
NOMBRE DEL CLIENTE:
TIPO DE MALLA:
PLANA
ROLLO
CANTIDAD DE MALLA COMPRADA:
TIEMPO COMO COMPRADOR:
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

Ayuda Porfavor :S

Publicado por ramon (2158 intervenciones) el 19/06/2014 20:01:37
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
{A ver si esto sirve}
 
program compras;
 {$N+}
 uses
    crt;
 const
     malla_plana = 400;
     malla_rollo = 520;
     maxd5 = 8;
     mend5 = 6;
     malla : array[1..2] of string[5] = (
     'plana','rollo');
     nomarchi = 'Cliente.dat';
 
  type
     string5 = string[5];
     cliente = record
          codigo : string[6];
          nombre : string[80];
          tipoma : string5;
          camtid : real;
          antigu : integer;
          total  : real;
          descue : real;
        end;
 
 
  var
     clien : cliente;
     archi : file of cliente;
     long, nh : longint;
     tecla : char;
 
 
  procedure guarda_archivo(cli : cliente);
  begin
     assign(archi,nomarchi);
   {$I-} reset(archi); {$I+}
      if ioresult <> 0 then
      begin
         rewrite(archi);
         seek(archi,0);
         write(archi,cli);
         close(archi);
      end
   else
      begin
         seek(archi,filesize(archi));
         write(archi,cli);
         close(archi);
      end;
  end;
 
  procedure carga_archivo(n : longint; var cli : cliente);
  begin
     assign(archi,nomarchi);
   {$I-} reset(archi); {$I+}
      if ioresult <> 0 then
      begin
         writeln('   Error De Archivo Pulse Una Tecla');
         readkey;
      end
   else
       begin
          long := filesize(archi) - 1;
          seek(archi,n);
          read(archi,cli);
          close(archi);
       end;
  end;
 
  procedure entrada_datos;
  var
     tec : char;
  begin
     clrscr;
     writeln('   ***** Entradas Pedido Cliente *****');
     writeln;
     with clien do
     begin
        write('   Entre Codigo Cliente : ');
        readln(codigo);
        write('   Entre Nombre Cliente : ');
        readln(nombre);
        write('   Elija Tipo Malla [P]=Plana  [R]=Rollo = ');
        repeat
            tec := upcase(readkey);
        until tec in['P','R'];
        if tec = 'P' then
        tipoma := malla[1]
     else
        tipoma := malla[2];
        write(tipoma);
        writeln;
        write('   Entre Cantidad       : ');
        readln(camtid);
        write('   Entre Antiguedad     : ');
        readln(antigu);
        if antigu > 5 then
        begin
        if tipoma = malla[1] then
        begin
       total := (camtid * malla_plana) - ((camtid * malla_plana) / maxd5);
       descue := ((camtid * malla_plana) / maxd5);
       end;
       if tipoma = malla[2] then
        begin
       total := (camtid * malla_rollo) - ((camtid * malla_rollo) / maxd5);
       descue := ((camtid * malla_rollo) / maxd5);
       end;
      end;
      if antigu <= 5 then
      begin
       if tipoma = malla[1] then
        begin
       total := (camtid * malla_plana);
       descue := 0.0;
       end;
       if tipoma = malla[2] then
        begin
       total := (camtid * malla_rollo);
       descue := 0.0;
       end;
      end;
    end;
        guarda_archivo(clien);
  end;
 
  procedure ingreso_recibido_por_cliente;
  begin
     clrscr;
     fillchar(clien,sizeof(clien),' ');
     nh := 0;
     repeat
      clrscr;
      carga_archivo(nh,clien);
      writeln('   ****** Datos Ingresos Por Cliente ******');
      writeln;
      writeln('  Codigo        : ',clien.codigo);
      writeln('  Ingreso Total : ',clien.total:0:2);
      writeln;
      writeln('  <<<<< Pulse Tecla[',chr(24),chr(25),'] O [Esc] Fin >>>>>');
      repeat
      tecla := readkey;
      until tecla in[#72,#80,#27];
      if tecla = #72 then
      begin
      nh := nh - 1;
      if nh < 0 then
      nh := 0;
      end;
      if tecla = #80 then
      begin
         nh := nh + 1;
         if nh > long then
         nh := long;
      end;
    until tecla = #27;
  end;
 
   function cantidad_malla_plana : real;
   var
      pcl : longint;
      venta : real;
   begin
      venta := 0;
      pcl := 0;
      repeat
         carga_archivo(pcl,clien);
         if clien.tipoma = malla[1] then
         venta := venta + clien.camtid;
         pcl := pcl + 1;
      until pcl > long;
      cantidad_malla_plana := venta;
   end;
 
   function cantidad_malla_rollo : real;
   var
      pcl : longint;
      venta : real;
   begin
      venta := 0;
      pcl := 0;
      repeat
         carga_archivo(pcl,clien);
         if clien.tipoma = malla[2] then
         venta := venta + clien.camtid;
         pcl := pcl + 1;
      until pcl > long;
      cantidad_malla_rollo := venta;
   end;
 
   function Malla_mas_vendida : string5;
   begin
       if cantidad_malla_rollo < cantidad_malla_plana then
       Malla_mas_vendida := malla[1];
       if cantidad_malla_rollo > cantidad_malla_plana then
       Malla_mas_vendida := malla[2];
   end;
 
   function clientes_con_descuento : integer;
   var
      tt : longint;
      gg : integer;
   begin
      tt := 0;
      gg := 0;
      clientes_con_descuento := 0;
    repeat
      carga_archivo(tt,clien);
      if clien.descue > 0 then
      gg := gg + 1;
      tt := tt + 1;
    until tt > long;
    clientes_con_descuento := gg;
   end;
 
   function total_descuentos : real;
   var
     tt : longint;
     desq : real;
   begin
      total_descuentos := 0.0;
      tt := 0;
      desq := 0.0;
     repeat
      carga_archivo(tt,clien);
      if clien.descue > 0 then
      desq := desq + clien.descue;
      tt := tt + 1;
    until tt > long;
      total_descuentos := desq;
   end;
 
   function total_ingresos : extended;
   var
     tt : longint;
     ingr : extended;
   begin
      total_ingresos := 0.0;
      tt := 0;
      ingr := 0.0;
     repeat
      carga_archivo(tt,clien);
      if clien.total > 0 then
      ingr := ingr + clien.total;
      tt := tt + 1;
    until tt > long;
      total_ingresos := ingr;
   end;
 
   procedure menu;
   var
     sal : boolean;
     te : char;
   begin
      sal := false;
    repeat
        clrscr;
        writeln('    ***** Menu Jeneral *****');
        writeln;
        writeln('   [E]=ntrada Datos');
        writeln('   [I]=ngreso Por Cliente');
        writeln('   [M]=alla Plana Vendida');
        writeln('   [R]=ollos Vendidos');
        writeln('   [V]=endido Mas Mallas');
        writeln('   [T]=otal Clientes Con Descuento');
        writeln('   [D]=escuento Total');
        writeln('   [C]=ompra Total');
        writeln('   [S]=alir');
        writeln;
        writeln('  <<<< Elija Opcion >>>>');
        repeat
            te := upcase(readkey);
        until te in['E','I','M','R','V','T','D','C','S'];
       case te of
   'E' : entrada_datos;
   'I' : ingreso_recibido_por_cliente;
   'M' : begin
          clrscr;
          writeln;
          writeln('   Cantidad Malla Plana = ',cantidad_malla_plana:0:2);
          writeln;
          writeln('   Pulse Una Tecla');
          readkey;
        end;
   'R' : begin
         clrscr;
         writeln;
         writeln('   Cantidad Malla Rollo = ',cantidad_malla_rollo:0:2);
         writeln;
         writeln('   Pulse Una Tecla');
         readkey;
         end;
   'V' : begin
           clrscr;
           writeln;
           writeln('   Malla Mas Vendida Es : ',Malla_mas_vendida);
           writeln;
           writeln('   Pulse Una Tecla');
           readkey;
         end;
   'T' : begin
           clrscr;
           writeln;
           writeln('   Clientes Con descuento = ',clientes_con_descuento);
           writeln;
           writeln('   Pulse Una Tecla');
           readkey;
         end;
   'D' : begin
           clrscr;
           writeln;
           writeln('   Total Descuento = ',total_descuentos:0:2);
           writeln;
           writeln('   Pulse Una Tecla');
           readkey;
         end;
   'C' : begin
          clrscr;
          writeln;
          writeln('   Total Ingresos = ',total_ingresos:0:2);
          writeln;
           writeln('   Pulse Una Tecla');
           readkey;
         end;
   'S' : 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
0
Comentar