Giter Site home page Giter Site logo

tstest's Introduction

A client wants to launch an e-commerce site to promote their brand, below are some of the products that they will be listing:

Products

ID Name Price
0001 Water Bottle 24.95
0002 Hoodie 65.00
0003 Sticker Set 3.99

The marketing team would like to run the following promotions;

  • If you spend over £75 then you get a 10% discount
  • If you buy two or more water bottles then the price drops to £22.99 each

Multiple promotions can be applied to the same checkout

The checkout system needs to be able to scan the items in any order then apply the promotion rules. These rules should be allowed to change over time. The pseudocode below outlines the interface for the checkout

checkout = new checkout(promotionalRules) checkout.scan(items) //List of item objects created from the products above println(checkout.total()) //e.g. £68.99

Implement a checkout that meets these requirements. Do not worry about the storage or retrieval of any items in a database, for the purpose of this test they only need to be processed.

Test Data

  • Items: 0001,0001,0002,0003 - Total Price: £114.97
  • Items: 0001,0001,0001 - Total Price: £68.97
  • Items: 0002,0002,0003 - Total Price: £120.59

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.