Giter VIP home page Giter VIP logo

ps_shipment's Introduction

Shipment Assignment

This program assigns shipment destinations to drivers in a way that maximizes the total suitability score over the set of drivers.

Requirements

Node.js

Input

The program takes as input two newline separated files, the first containing the street addresses of the shipment destinations and the second containing the names of the drivers.

Output

The program prints the total suitability score and a match between shipment destinations and drivers.

Usage

  1. Clone the repository or download the javascript file

  2. Open a command prompt and navigate to the directory where the file is located

  3. Run npm install to add required dependencies

  4. Create two files, the first containing the street addresses of the shipment destinations, and the second containing the names of the drivers

  5. Run the command node shipment_assignment.js [destinations_file] [drivers_file]

    • Replace [destinations_file] with the file name of the destinations file

    • Replace [drivers_file] with the file name of the drivers file

Example

Assume that you have two files in the same directory as your javascript file

  • destinations.txt with the following content
JS Ave
Python Dr
Go Town
  • drivers.txt with the following content
John Doe
Mary Doe
Ben Doe
  • You can run the code by typing in the command line :
node shipment_assignment.js destinations.txt drivers.txt
  • This will execute the program and print the output on the console:
Total Suitability Score: 15.5
Shipment Destination - Driver Matches:
JS Ave - John Doe
Python Dr - Mary Doe
Go Town - Ben Doe

The output is the total SS and the matching between shipment destinations and drivers. The output is generated based on the top-secret algorithm defined in the problem statement.

Note

  • The program is case-insensitive
  • The program does not handle malformed input

Top-secret algorithm

  • If the length of the shipment's destination street name is even, the base suitability score (SS) is the number of vowels in the driver’s name multiplied by 1.5.
  • If the length of the shipment's destination street name is odd, the base SS is the number of consonants in the driver’s name multiplied by 1.
  • If the length of the shipment's destination street name shares any common factors (besides 1) with the length of the driver’s name, the SS is increased by 50% above the base SS.

ps_shipment's People

Contributors

seunafara avatar

Watchers

 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.