Coder Social home page Coder Social logo

hotelroombooking's Introduction

Hotel Room Booking CLI

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.

Ruby Version

  • 3.2.1

Inputs

The CLI will prompt the user for the following inputs:

  1. First Name
  2. Last Name
  3. Age
  4. Number Of Rooms Required
  5. Number Of Days to Accommodate

Process

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:

  1. Age Requirement: The user must be above 18 years old to book a room.
  2. Room Limit: The number of rooms required should be 3 or fewer.
  3. 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.

Commands

  1. ruby rooms.rb: To execute the code by providing the inputs and check how it works.
  2. ruby tests/test_rooms.rb: To test the code with MiniTest and check whether it is providing the expected output or not.

Getting Started

To get started with the project, follow these steps:

  1. Clone the Repository:

    git clone <repository-url>
    cd <repository-name>
  2. Ensure you have the correct Ruby version:

    ruby -v
  3. Run the Application:

    ruby rooms.rb
  4. Run the Tests:

    ruby tests/test_rooms.rb

Example 1

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

Output 1

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.

Example 2

$ 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

Output 2

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.

Example 3

$ 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

Output 3

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

Project2 : Vehicle Management

Project 3 : Library Management

hotelroombooking's People

Contributors

boddulurisrisai avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.