It's a Spring Boot API that provides an interface for hotels to enter the numbers of Premium and Economy rooms that are available for the night and then tells them immediately how many rooms of each category will be occupied and how much money they will make in total.
- Java 17
- Spring Boot 3
- Gradle
What things you need to install before running the application:
- Java JDK 17 or higher
- Gradle (if not already installed)
- Clone the repository:
git clone https://github.com/laszlokelemen/room-occupancy-manager.git
- Change into the project directory:
cd room-occupancy-manager
- Build the application:
gradle build
- Run the application:
gradle bootRun
The app will start running at http://localhost:8080
Method | Url | Description | Sample Valid Request Body | Sample Valid Response Body |
---|---|---|---|---|
POST | /room/optimize | Optimize room occupancy. | JSON | JSON |
{
"guests": [
23,
45,
155,
374,
22,
99.99,
100,
101,
115,
209
],
"numberOfFreeEconomyRooms": 3,
"numberOfFreePremiumRooms": 3
}
{
"usagePremium": 3,
"usageEconomy": 3,
"pricePremium": 738,
"priceEconomy": 167.99
}