Thread: Hotel Booking system

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    20

    Hotel Booking system

    I am trying to create a ms-dos hotel booking system for college.
    It is just an exercise.

    I need to mimic checking for room availability. If a certain room is booked for a certain date I need to know.
    I am having trouble thinking of the best way to cross reference dates and rooms.

    A 3d array? month, date, room?
    Seems like the array will get really big

    Anybody got any tips on how to structure this...

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472

    objects

    one way you could do it is create a Class, eg 'Accomodation'
    give it attributes required, like

    bool is_booked
    string date_from
    string date_to

    then declare an array of objects for this class, eg

    Accomodation room[100]

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    20
    So if I use malloc/realloc I can make that dynamic?
    rather then a static [100]

    Then I can search by date first, then, if any dates overlap, check each object by room

    Code:
    For(amount of accomodation objects)
       if (dates overlap)
          if (room booked)
                    invalid booking
          end
       end
    
       else
    
       rooms are bookable, make booking (booking constructor)
    end
    that should work.. seems a lot more efficient on memory.
    Thanks rogster
    Last edited by TenTierHook; 03-16-2010 at 06:19 AM. Reason: ?

  4. #4
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    yes but the thing is, in terms of modelling a hotel normally has a fixed number of rooms, and isnt that the point you need...that you want to check the register (read 'the properties of room object' ) of rooms and see if they are available or not, so the room must already be constructed to do that anway..?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File System Implementation
    By dodgeviper in forum C Programming
    Replies: 9
    Last Post: 11-16-2007, 01:04 PM
  2. Using system icons
    By @nthony in forum Windows Programming
    Replies: 1
    Last Post: 01-13-2007, 07:56 PM
  3. Linux database system needed
    By BobS0327 in forum Tech Board
    Replies: 7
    Last Post: 06-11-2006, 03:56 PM
  4. measuring system resources used by a function
    By Aran in forum C Programming
    Replies: 1
    Last Post: 03-13-2006, 05:35 PM
  5. BIOS system and memory allocation problem
    By beely in forum Tech Board
    Replies: 9
    Last Post: 11-25-2003, 07:12 AM