Download presentation
Presentation is loading. Please wait.
Published bySibyl Sanders Modified over 8 years ago
1
Hotel reservation system Team A Benjamin Bach Ard Bahlman Paul van der Ende
2
Problem statement An online hotel reservation system. The customer can provide the system with a start date, end date, types of rooms and number of persons to fit in each room. –There are different kind of rooms, the rooms vary in capacity. The system returns exact matches and/or multiple suggestions. The customer can pick a match or suggestion and make a reservation.
3
Data Int = A non-negative integer Date = A date containing day, month, year Hotel rooms –Room numberroomNumber :: Int –Capacitycapacity :: Int Room(roomNumber, capacity) Reservations –Reservation numberreservationNumber:: Int –Room numberroomNumber :: Int –Number of personsnumberPersons :: Int –Start datestartDate :: Date –End dateendDate :: Date Reservation(roomNumber, numberPersons, startDate, endDate)
4
Input for Query The customer can fill in a form to specify his preferences. startDate:: Date endDate:: Date roomList:: [(Int, Int)] –roomList means a list of all preferred kind of rooms and preferred number of persons (capacity, numberOfPersons) Constraints on input –startDate > currentDate currentDate means the date of the time the input takes place –endDate > startDate –length (roomList) > 0 Length is a function that returns the size of a list –numberOfPersons > 0 –numberOfPersons =< capacity
5
Matches/Suggestions An intermediate step for the reservation is that the customer can select a match or suggestion. Function –query :: ([Room], [Reservation]) -> Date -> [(Int, Int)] -> ([Reservation], [Reservation]) –(matches, suggestions) = query ((dataRooms, dataReservations), startDate, endDate, roomList) –Recall: Reservation(roomNumber, numberPersons, outStartDate, outEndDate) The result of the query function are two lists, matches and reservations. –Matches are exact matches on all properties –Suggestions differ in amount of rooms or different number of persons per room. –Maximum size of both list of reservations is limited by some value defined by the system to prevent too much results.
6
Constraints on Matches/Suggestions Recall: (matches, suggestions) = query ((dataRooms, dataReservations), startDate, endDate, roomList) Constraints – res (matches suggestions) : res.outStartDate = startDate Λ res.outEndDate = endDate Λ ! res2 dataReservations : res2.roomNumber = res.roomNumber Λ ( res.startDate res2.startDate res.endDate V res.startDate res2.endDate res.endDate V (res2.startDate res.endDate) Λ room dataRooms : room.roomNumber = res.roomNumber Explaination: 1.The suggested reservations must have the same start and end data as the requested reservation 2.The suggested reservations must not have a start or end date between any already existing reservation 3.The suggested reservations must not have a start date before any existing start date of and end date after any existing end date 4.These constraints hold only if the two rooms are actually the same room.
7
Constraints on Matches/Suggestions (ctd) Recall: (matches, suggestions) = query ((dataRooms, dataReservations), startDate, endDate, roomList) maches suggestions = res1, res2 matches : res1 != res2 res1, res2 suggestions : res1 != res2 (?, roomCapacity) roomList : res1 matches : room1 dataRooms: room1.roomNumber = res.roomNumber Λ room1.capacity = roomCapacity 1.Rooms are compared by their roomNumber 2.We require that every room in the matches list has exact the same capacity as is requested for by the Customer. (some constraint) s.numberOfPersons x 1.The sum of the capacity has to exceed the sum of the number of persons the customer wants to make reservations for – but not exceeding more than some unspecified constraint. s suggestions(x, ?) roomList
8
Reservation The system displays the results (matches and suggestions) of the query on screen. The customer can select only one match or suggestion to make a reservation. makeReservation :: Reservation -> Int reservationNumber = makeReservation (selectedReservation) –Constraint: The reservation still has to be available. Side effect of the makeReservation is that the reservation is saved in the database. The result of the makeReservation is that the reservation number is displayed on the screen. –The customer can use the reservation number to refer to his reservation.
9
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.