mccraveiro / NuPack

NuPack repackaging calculator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NuPack

NuPack repackaging calculator

Instructions

  1. Please answer the following question using JavaScript without using any third party plugins or libraries, with the exception of Jasmine, Mocha, etc for unit tests.

  2. Treat this problem as a library. No UI or file/console input is expected or required.

  3. Please submit via publicly accessible repo so that we can review your commits.

Pricing problem

NuPack is responsible for taking existing products and repackaging them for sale at electronic stores like Future Shop and Best Buy. Companies will phone up NuPack, explain the process and NuPack needs to quickly give them an estimate of how much it will cost. Different markups to the job:

  • Without exception, there is a flat markup on all jobs of 5%
  • For each person that needs to work on the job, there is a markup of 1.2%

Markups are also added depending on the types of materials involved:

  • If pharmaceuticals are involved, there is an immediate 7.5% markup
  • For food, there is a 13% markup
  • Electronics require a 2% markup
  • Everything else, there is no markup

Another system calculates the base price depending on how many products need to be repackaged. As such, the markup calculator should accept the initial base price along with the different categories of markups and calculate a final cost for a project.

The flat markup is calculated first and then all other markups are calculated on top of the base price plus flat markup.

For example...

Input 1:

$1299.99
3 people
food

  • Output: $1591.58

Input 2:

$5432.00
1 person
drugs

  • Output: $6199.81

Input 3:

$12456.95
4 people
books

  • Output: $13707.63

Usage

var example = new NuPack();
example.setBaseCost(1299.99);
example.setNumberOfPeople(3);
example.setTypeOfProduct("food");
example.getFinalCost();

About

NuPack repackaging calculator