GithubHelp home page GithubHelp logo

calculator-coding-test's Introduction

Running

Install dependencies using yarn install.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

The App

The app allows users to submit items they want to sell. They can either submit auction items or fixed price buy it now items. Submitting items comes with a fee. The fee is calculated according to a set of rules detailed bellow.

Assignment

The code in this small app is on purpose quite horrible. Your task is to improve it. You should not spend more than 2-4 hours. Choose 2 areas of improvement and change the code accordingly.

  • The calculator code is not very maintainable and has very poor test coverage. Try improving this code.
  • The react App component is a bit messy in many ways. Any ideas for how to refactor and break this apart?
  • Add validation and error handling in the Register new item form so you cannot press submit when form values are not valid or incomplete.
  • Show added items in a card design with information styled nicely.

During the technical interview we can talk through your changes and also discuss other changes you would like to do.

When you want to submit your changes, remove the node_modules folder, zip the folder and attach it in an email. We kindly ask you not to publish your solution.

Details on the fee calculator

Calculate the fee for publishing an ad. Refactor the code to something that you're satisfied with - code that you would want to maintain.

Conditions

In this example there are two types of ads:

  • Auction (bids are placed until an ad ends)
  • Buy it now (an ad is bought directly and thereby ending)

There's two types of users:

  • Company users
  • Non-company users (normal)

Calculation rules

The formula to calculate the sum of fees is:

  • Price of the ad + type of ad cost - discount

Costs:

Ad type Cost
Auction 25
Buy It Now 35

Discounts:

  • If an ad ends today there's a discount of 10.
  • Company users get a discount of 5 when they publish an ad.

New desired feature:

In the code example, the end date discount are only implemented for auctions, but we would like it to also work for Buy It Now ads. You only need to do this if you choose to improve the calculator code.

calculator-coding-test's People

Contributors

yassinejebli avatar

Stargazers

 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.