GithubHelp home page GithubHelp logo

fooder's Introduction

fooder

Online Food Delivery Management System

Problem Statement โ€”

Design an API to calculate food delivery time based on the following conditions. Each restaurant has a maximum capacity of only 7 cooking slots. Each appetizer (A) requires 1 cooking slot and every Main Course (M) requires 2 cooking slots. Appetizers require 17 minutes to be prepared and main courses take 29 minutes. Assume that the delivery time can be calculated by a simple formula that every 1km can be covered in 8 minutes.

You have to calculate how much time it would take for an order to be delivered. The orders come in and are maintained in a queue. If the restaurant cannot accommodate a new order it gets queued and the estimated time for its delivery gets calculated.

Additional rules :-

If an order is going to take more than 2 hour 30 minutes to get delivered, it gets denied.

  • Every order has a 2 digit unique id.
  • You cannot change the order of entries in the queue.
  • If any order in itself cannot be prepared at once it will be denied. (Look at order 14 in the sample output)
  • A new order can start only if it has the required free slots available to accommodate it.
  • If a new order comes and does not have enough free slots, it has to wait till any of the previous order gets completed. An order can only be marked as completed if it gets delivered and the next order can start cooking only then.
  • No orders can be cooked in parts.
  • All orders come in at the same time.
  • Please use the exact input file as given below.

Input -

[{"orderId": 12, "meals": ["A", "A"], "distance": 5},
{"orderId": 21, "meals": ["A", "M"], "distance": 1},
{"orderId": 14, "meals": ["M", "M", "M", "M", "A", "A", "A"], "distance": 10},
{"orderId": 32, "meals": ["M"], "distance": 0.1},
{"orderId": 22, "meals": ["A"], "distance": 3}]

Output -

Order 12 will get delivered in 57 minutes
Order 21 will get delivered in 37 minutes
Order 14 is denied because the restaurant cannot accommodate it.
Order 32 will get delivered in 29.8 minutes
Order 22 will get delivered in 70.8 minutes

fooder's People

Contributors

akshattrivedi 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.