Tech Stack: C#, DotNet Core 3.1, xUnit
The console application is designed for a movie theater seating that maximizes customer satisfaction as well as customer safety.
- Seats will be booked in FIFO fashion i.e., on a first-come first-serve basis.
- To maximize customer satisfaction we will book seat farthest from the screen first and keep on moving forward as the booking requests increases.
- To maximise the customer satisfaction we also make sure to book the seats together for each booking if possible.
- If the next available fartest row from the screen can't fit all the seats of a reservation then we move on to the next available row.
- When the requested number of seats in a single booking is more than 20 i.e., more than row capacity we inform the customer to consult the customer support for group/corporate booking.
- If the number of seats requested are more than the available seats in the theater we inform the customer that the theater is housefull.
- If booking for seats is not possible in one single row then we split the booking into two different rows which have seats available.
- To ensure maximum customer safety we keep a buffer of three seats and one row between each booking request.
- Open Terminal at movie-theater-seating/Movie.Theater.Seating
- To build the solution execute either of the below command
Command:dotnet build Movie.Theater.Seating.sln
dotnet msbuild Movie.Theater.Seating.sln - To run the console app
Command:dotnet run --project ./Movie.Theater.Seating.Console/Movie.Theater.Seating.Console.csproj -- "/Users/aniket/movie-theater-seating/booking/input.txt"
- If file path is not specified, the program will pick the default input file present inside booking folder.
- After executing the above command the path to the output file will be displayed on the terminal.
- To run the unit tests
Command:dotnet test ./Movie.Theater.Seating.UnitTests/Movie.Theater.Seating.UnitTests.csproj
- Movie.Theater.Seating.Console: It has the main logic of driving the program. It reads the input file calls the service layer for booking and returns output.
- Movie.Theater.Seating.Service: This is the service layer implementation where all the main logic of booking seats in theater is written.
- IBookingService: Interface which specifies contract for booking seats. It is implemented by BookingService.
- BookingService: Process the booking of individual request and implements the IBookingService contracts.
- TheaterRow: Has the logic of operations which can be performed on each row such as book seats in row and keep a buffer of three seats for customer safety.
- Movie.Theater.Seating.UnitTests: Unit tests for various scenarios are written here.