Giter VIP home page Giter VIP logo

testrentalservice's Introduction

TestRentalService

Requirements:

  1. This Vehicle Rental Service will be operational only in one city (Delhi) which will have multiple branches (eg. Vasant Vihar Branch, CP branch, etc).
  2. Each branch can have three different types of vehicles (VehicleType) : Sedan, Hatchback, SUV. There could be any number of vehicles of each type in a branch.
  3. The rental price per hour should be defined at “per branch per vehicle type” level and NOT at an individual vehicle level. (eg. Sedan in CP branch = 150 rs/hr, Sedan in Vasant Vihar = 100 rs/hr, Hatchback in CP = 80rs/hr and so on)
  4. A user can request to rent a particular vehicle type for a given time slot. You will have to allot the vehicle from one of the branches if available for the given time slot with the “lowest rental price” strategy.

The following APIs have to be implemented: Note: The given parameters are the mandatory parameters, you are free to add more parameters as part of your apis if you feel the need to do so. The return type of each api is up to you but make sure it provides the relevant information needed.

addBranch(branchName) This will add a new branch for your Service.

allocatePrice(branchName, vehicleType, price); This will be used to define price per vehicle type per branch

addVehicle(vehicleId, vehicleType, branchName); This will add a new vehicle of the given vehicle type in a given existing branch.

bookVehicle(vehicleType, startTime, endTime) This will be used to rent a vehicle for the given vehicle type for a given time slot defined by Start time and end time. You can expect the start time and endTime to be in hourly slots only.

[Optional]viewVehicleInventory(startTime, endTime): This will give a snapshot of the inventory for the given time slot i.e. all the vehicles that are available and all the vehicles that are not available categorised by vehicleType.

Guidelines:

  1. You should store the data in-memory using a language-specific data-structure.
  2. You can print the output in console.
  3. Design your application in a way that a new rental Strategy can be implemented and used instead of the default one (lowest price).
  4. Implement clear separation between your data layers and service layers.
  5. You can take the startTime and endTime as DateTime or in any other way as you prefer.
  6. The start time and end time will be in hourly granularity only.

Expectations:

  1. Your code should cover all the mandatory functionalities explained above.
  2. Your code should be executable and clean.
  3. Your code should be properly refactored, and exceptions should be gracefully handled.

testrentalservice's People

Contributors

yugander-krishan-singh 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.