Hotel Reservation System

Download Report

Transcript Hotel Reservation System

Hotel Reservation System
Team B:
Christiaan Ypma
Martijn Nijenhof
Oscar de Groot
Tom Hastjarjanto
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.
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.

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)
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.
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]

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.
Output helper function
roomAvailable( room, db ):
 dbRoom  db (
room.price == dbRoom.price 
room.singleBeds == dbRoom.singleBeds 
room.doubleBeds == dbRoom.doubleBeds 
room.availableNights  dbRoom.availableNights
)
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.
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).