Giter VIP home page Giter VIP logo

logica-de-programacao-nodejs's Introduction

Lucas Paganini Programming Logic Test

With NodeJS v14 (or superior) installed, run the following scripts:

  • npm clean-install to install the project dependencies
  • npm test to run the tests

In the src/ folder, there are 3 tasks waiting for you. They do not need to be completed in order but it is recommended because they are in order of dificulty.

You have 4 hours (since downloading this project) to implement the 3 functions and pass the tests.

Task 01 - Round with precision

In the src/1-round-with-precision/round-with-precision.ts file, you need to implement the function that rounds the given number using the given decimal precision points.

Rounding 33.33333 with 2 decimal points would result in 33.33 and rounding it with 0 decimal points would result in 33.

You can look at the tests to see more examples of how the function should behave.

Task 02 - Get precision

In the src/2-get-precision/get-precision.ts file, you need to implement a function that returns the amount of decimal precision points for a given number.

12.25 has 2 decimal precision points. 12.2 has 1 decimal precision point. 12.250000 has 2 decimal precision points (because it's the same as 12.25).

You can look at the tests to see more examples of how the function should behave.

Task 03 - Auto distribute

In the src/3-auto-distribute/auto-distribute.ts file, you need to implement a function that auto distributes a number in a given amount of parts with a given amount of decimal precision points.

For example, dividing 100 in 4 parts with 0 decimal precision points would result in [ 25, 25, 25, 25 ].

If the number is not divisible by the amount of parts, the remaining difference should be distributed starting from the first elements. For example, dividing 100 in 3 parts with 2 decimal precision points would result in [ 33.34, 33.33, 33.33 ]. Notice that the 0.01 diff went to the first element.

You can look at the tests to see more examples of how the function should behave.

Sending

You can send your work in two ways:

  1. Create a Github repository and share it with lucaspaganini

OR

  1. Zip your project, put it in Google Drive and send a link to download it to [email protected]

Good luck!

logica-de-programacao-nodejs's People

Contributors

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