Download presentation
Presentation is loading. Please wait.
Published byKristopher Patrick Modified over 9 years ago
1
Hotel Reservation System Team B: Christiaan Ypma Martijn Nijenhof Oscar de Groot Tom Hastjarjanto
2
Problem statement A hotel has various types of rooms. ◦ Dimensions of variation: price, number of single beds, number of double beds. ◦ A database with a listing of all the rooms of the hotel is supplied. This database includes when the rooms have been booked. People can look for availability on a website for a certain type of room (room price), for a certain time span. The system checks availability and returns a proposition that fits the reservation. If no exact match is found, something similar is proposed with at least the same person capacity.
3
Simplifying assumptions People don’t want to switch rooms during their stay. Ever. People don’t care whether or not rented rooms are physically close to each other. People always want to rent all their desired rooms for the same nights.
4
Type definitions Database ◦ The database is a list of records of the following format: ◦ Database := [Room] ◦ Room := (Integer price, Integer singleBeds, Integer doubleBeds, [Night] availableNights)
5
Type definitions: user input User Input ◦ UserInput := [Room], where the list of nights indicates which nights the user wants to stay. Note that the user does not necessarily have to enter a number for the price. He could select a certain room type, price class, or anything else that can be converted symmetrically to a price.
6
Output The output of the system must be either a booking option that exactly matches the user’s request, or a list of alternative options if no exact match is possible. Errable A := Result A | Exception BookingOption := [Room] GetExactMatch :: UserInput Database Errable BookingOption GetFuzzyMatch :: UserInput Database [BookingOption]
7
Output exact match input, db, exactMatch: Result exactMatch = GetExactMatch input db room input ( roomAvailable(room, db) ) exactMatch == input Make sure that no two rooms in the input match the same room in the database.
8
Output helper function roomAvailable( room, db ): dbRoom db ( room.price == dbRoom.price room.singleBeds == dbRoom.singleBeds room.doubleBeds == dbRoom.doubleBeds room.availableNights dbRoom.availableNights )
9
Output fuzzy match GetFuzzymatch :: UserInput Database [BookingOption] input, db, fuzzyMatches : fuzzyMatches = GetFuzzyMatch input db fuzzyMatch fuzzyMatches ( room fuzzyMatch ( roomAvailable( room, db ) ) TotalSleepingPlaces fuzzyMatch ≥ TotalSleepingPlaces input fuzzyRoom fuzzyMatch, inputRoom input ( fuzzyRoom.nights == inputRoom.nights ) ) Make sure that no two rooms in the fuzzyMatch match the same room in the database.
10
Output helper function (2) TotalSleepingPlaces :: [Room] Int TotalSleepingPlaces returns the total number of sleeping places in the list of rooms (two times the number of total double beds plus the total number of single beds).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.