This project is a Command Line Interface (CLI) application that allows users to book a room in a hotel by taking inputs directly from the command line.
3.2.1
The CLI will prompt the user for the following inputs:
- First Name
- Last Name
- Age
- Number Of Rooms Required
- Number Of Days to Accommodate
Based on the provided inputs, the code will determine if the user is eligible to book a room. The eligibility criteria and booking rules are as follows:
- Age Requirement: The user must be above 18 years old to book a room.
- Room Limit: The number of rooms required should be 3 or fewer.
- Duration Limit: The number of days for the booking should be less than 10.
If all the above conditions are satisfied, the room(s) will be booked. If any of the conditions are not met, the booking will be denied.
- ruby rooms.rb: To execute the code by providing the inputs and check how it works.
- ruby tests/test_rooms.rb: To test the code with MiniTest and check whether it is providing the expected output or not.
To get started with the project, follow these steps:
-
Clone the Repository:
git clone <repository-url> cd <repository-name>
-
Ensure you have the correct Ruby version:
ruby -v
-
Run the Application:
ruby rooms.rb
-
Run the Tests:
ruby tests/test_rooms.rb
Upon running ruby rooms.rb
, you will be prompted to enter the required information. Here's an example interaction:
$ ruby rooms.rb
Enter your first name: Srisai
Enter your last name: Bodduluri
Enter your age: 25
Enter the number of rooms required: 2
Enter the number of days to accommodate: 5
Hi Srisai Bodduluri your booking of 2 rooms for 4 days has been initiated.
Your total cost is $4800. Thank you for using our services.
$ ruby rooms.rb
Enter your first name: Srisai
Enter your last name: Bodduluri
Enter your age: 11
Enter the number of rooms required: 9
Enter the number of days to accommodate: 12
Hi Srisai Bodduluri your booking of 9 rooms for 12 days is not successful as your age is less than 18 years.
We don't have 9 rooms in our restaurant
We won't accomodate more than 10 days.
$ ruby tests/test_rooms.rb
Enter your first name: Srisai
Enter your last name: Bodduluri
Enter your age: 25
Enter the number of rooms required: 3
Enter the number of days to accommodate: 2
Hi Srisai Bodduluri your booking of 3 rooms for 2 days has been initiated.
Your total cost is $3600. Thank you for using our services.
Run options: --seed 42446
# Running:
..
Finished in 0.001774s, 1127.5909 runs/s, 1127.5909 assertions/s.
2 runs, 2 assertions, 0 failures, 0 errors, 0 skips