Pascal/Turbo Pascal - Ayuda con un problema

 
Vista:

Ayuda con un problema

Publicado por Imelda Lorena (2 intervenciones) el 15/10/2013 03:37:17
Hola necesito ayuda para resolver este ejercio en pascal.

Calcule el costo total de un vehículo al estar estacionado por una hora en el estacionamiento "La escala" y al final despliegue el total de autos y el costo total por día.

espero me ayuden 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

Ayuda con un problema

Publicado por ramon (2158 intervenciones) el 18/10/2013 11:26:13
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
{Esto servirá}
 
 program estaciona;
  uses
     crt;
  const
     preci_minut = 0.10;
     veicu = 40;
  type
     autos = record
            matricula : string[20];
            inicio    : real;
            final     : real;
            prectot   : real;
          end;
 
  var
    estaci : array[1..veicu] of autos;
    datauto : autos;
    cont : integer;
    tecla, te : char;
 
   procedure aparca_auto;
   begin
       clrscr;
       writeln('*** Ficha Aparcamiento ***');
       writeln;
       write('  Matricula   : ');
       readln(datauto.matricula);
       write('  Hora Inicio : ');
       readln(datauto.inicio);
       writeln;
       writeln('<<<<< Datos Correctos [S/N] >>>>>');
       repeat
           te := upcase(readkey);
       until te in['S','N'];
       if te = 'S' then
       begin
       cont := cont + 1;
       if cont > veicu then
       cont := veicu;
       estaci[cont] := datauto;
       end;
   end;
 
   procedure desaparca_auto;
   var
      matri : string[20];
      nu : integer;
      est : boolean;
   begin
       clrscr;
       writeln('*** Cobro Estancia Auto ***');
       writeln;
       write('  Entre Matricula : ');
       readln(matri);
       nu := 1;
       est := false;
       repeat
           if estaci[nu].matricula = matri then
           begin
              est := true;
           end
         else
           nu := nu + 1;
       until (nu > cont) or (est = true);
       if est = true then
       begin
          clrscr;
          writeln('  Matricula   = ',estaci[nu].matricula);
          writeln('  Hora Inicio = ',estaci[nu].inicio:0:2);
          write('  Entre Hora Final : ');
          readln(estaci[nu].final);
          writeln;
    estaci[nu].prectot := ((estaci[nu].final - estaci[nu].inicio) * 60) *
                                 preci_minut;
          writeln('  Importe Avonar Es = ',estaci[nu].prectot:0:2,' $');
          estaci[nu].matricula := '0';
          writeln;
          writeln('<<< Pulse Una Tecla >>>');
       end
     else
        writeln('???? Error De Matricula Pulse Una Tecla ????');
        readkey;
   end;
 
   procedure total_autos_costo_total;
   var
     total : real;
     n, auto : integer;
   begin
      clrscr;
      for n := 1 to cont do
      total := total + estaci[n].prectot;
      auto := cont;
      writeln('**** Los Resultados Son ****');
      writeln;
      writeln('   Total De Autos = ',auto);
      writeln('   Ingreso Total  = ',total:0:2);
      writeln;
      writeln('<<<< Pulse Una Tecla >>>>');
      readkey;
   end;
 
   procedure menu;
   var
    opc, teb : char;
    sal : boolean;
  begin
      sal := false;
    repeat
       clrscr;
       writeln('***** Menu Principal *****');
       writeln;
       writeln('  1 = Entradas Aparcamiento');
       writeln('  2 = Salidas Aparcamiento');
       writeln('  3 = Resultado Total');
       writeln('  4 = Salir');
       writeln;
       writeln('<<<<<< Elija Opcion >>>>>>');
       repeat
           teb := readkey;
       until teb in['1','2','3','4'];
       clrscr;
     case teb of
  '1' : aparca_auto;
  '2' : desaparca_auto;
  '3' : total_autos_costo_total;
  '4' : sal := true;
    end;
    until sal = true;
   end;
 
   begin
      cont := 0;
      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