Pascal/Turbo Pascal - xfa ayudenme es de pascal funciones y procedimientos

 
Vista:

xfa ayudenme es de pascal funciones y procedimientos

Publicado por angel (1 intervención) el 12/05/2016 02:14:20
Proyecto 2.4: Hotel
Se requiere un programa que permita llevar el control de las 32 habitaciones que posee un hotel, se debe saber que las primeras 15 habitaciones son individuales o para parejas, las siguientes 7 habitaciones con triples y las últimas 10 son cuadruples. Los datos de los huéspedes deben ser almacenados en una matriz y el programa debe permitir realizar las siguientes opciones:
Registrar un nuevo huésped: nombre, apellido, sexo, edad, cédula y cantidad de noches que el cliente estará hospedado en el hotel. El cliente debe ser agregado a una habitación de acuerdo a la cantidad de huéspedes que lo acompañen y a la disponibilidad de habitaciones.
Conocer el % de clientes de sexo femenino y el % de sexo masculino.
Listar todos los datos de los clientes de las habitaciones ocupadas.
Indicar el promedio de días que se ocupan las habitaciones.
Indique si una habitación determinada está ocupada o no (de estar ocupada, debe mostrar los datos de ocupación).
Conocer el total de dinero recaudado en el hotel. Para ello debe considerar que las habitaciones individuales tienen un costo por noche de 2500, las matrimoniales 4500, las triples 6000 y las cuadruples 7000.


El programa debe contener un mínimo de 3 procedimientos y 2 funciones y debe contener un menú.
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

xfa ayudenme es de pascal funciones y procedimientos

Publicado por ramon (2158 intervenciones) el 13/05/2016 17:43: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
{A ver si esto va ayudando un poco}
 
 program habitacionesotel;
 uses
    crt;
    const
        habit = 32;
        indiv = 15;
        tripl = 7;
        cuadr = 10;
        costo_indi = 2500;
        costo_matr = 4500;
        costo_trip = 6000;
        cost_cuadu = 7000;
   type
 
     huesped = record
           nombre : string[80];
         apellido : string[80];
             sexo : char;
             edad : integer;
             cedu : longint;
             tiem : integer;
             esta : boolean;
             matr : char;
             impo : real;
           end;
 
 
    var
     habitaindi : array[1..indiv] of huesped;
     habitatripl : array[1..indiv] of huesped;
     habitacuadr : array[1..cuadr] of huesped;
     nindi, ntripl, ncuadr : integer;
 
 
 
   procedure ectrada_huesped;
   var
     te : char;
     hu : huesped;
     libre : boolean;
   begin
      libre := true;
      fillchar(hu,sizeof(hu),0);
      writeln(' ***** Entrada Huesped *****');
      writeln;
      write('   Nombre   : ');
      readln(hu.nombre);
      write('   Apellido : ');
      readln(hu.apellido);
      write('   Sexo   [F] [M]  : ');
      readln(hu.sexo);
      write('   Edad     : ');
      readln(hu.edad);
      write('   N.Cedula : ');
      readln(hu.cedu);
      write('   Tiempo   : ');
      readln(hu.tiem);
      hu.esta := true;
      write('   I=Individual M=Matrimonio T=Triple C=Cuadruple');
     repeat
         te := upcase(readkey);
     until te in['I','M','T','C'];
     hu.matr := te;
   case te of
 'I' : if nindi <= indiv then
        begin
          habitaindi[nindi] := hu;
          nindi := nindi + 1;
        end
      else
         begin
            libre := false;
         end;
 'M' : if nindi <= indiv then
        begin
          habitaindi[nindi] := hu;
          nindi := nindi + 1;
        end
      else
         begin
            libre := false;
         end;
 'T' : if ntripl <= tripl then
       begin
          habitatripl[ntripl] := hu;
          ntripl := ntripl + 1;
       end
     else
        begin
           libre := false;
        end;
 'C' : if ncuadr <= cuadr then
       begin
          habitacuadr[ncuadr] := hu;
          ncuadr := ncuadr + 1;
       end
     else
        begin
          libre := false;
        end;
    end;
      if libre = false then
      begin
      writeln;
      writeln('   Tipo Elegido No Disponible Pulse Una Tecla');
      readkey;
   end
  else
      begin
        writeln;
        writeln('   Habitacion Asignada Pulse Una Tecla');
        readkey;
      end;
  end;
 
 
  procedure clientes_fm_mc;
  var
    tot, k, i, m, t, c, fem, masc : integer;
  begin
     i := nindi - 1;
     m := ncuadr - 1;
     t := ntripl - 1;
     c := ncuadr - 1;
     masc := 0;
     fem := 0;
     for k := 1 to i do
     begin
     if upcase(habitaindi[k].sexo) = 'F' then
     fem := fem + 1;
     if upcase(habitaindi[k].sexo) = 'M' then
     masc := masc + 1;
     end;
     for k := 1 to m do
     begin
     if upcase(habitaindi[k].sexo) = 'F' then
     fem := fem + 1;
     if upcase(habitaindi[k].sexo) = 'M' then
     masc := masc + 1;
     end;
     for k := 1 to t do
     begin
     if upcase(habitatripl[k].sexo) = 'F' then
     fem := fem + 1;
     if upcase(habitatripl[k].sexo) = 'M' then
     masc := masc + 1;
     end;
     for k := 1 to c do
     begin
     if upcase(habitacuadr[k].sexo) = 'F' then
     fem := fem + 1;
     if upcase(habitacuadr[k].sexo) = 'M' then
     masc := masc + 1;
     end;
     tot := fem + masc;
     writeln;
     writeln('   Total Femeninos ',(tot * fem) / 100:0:2,' %',
     '   Total Masculinos ',(tot * masc) / 100:0:2,' %');
     writeln;
     writeln('   Pulse Una Tecla');
     readkey;
  end;
 
 
 
 
 
  begin
    clrscr;
    fillchar(habitaindi,sizeof(habitaindi),0);
    fillchar(habitatripl,sizeof(habitatripl),0);
    fillchar(habitacuadr,sizeof(habitacuadr),0);
    nindi := 1;
    ntripl := 1;
    ncuadr := 1;
    ectrada_huesped;
    clientes_fm_mc;
 
  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