Giter VIP home page Giter VIP logo

supermarket-exercise's Introduction

Supermarket Pricing Coding Exercise

Problem Description

Your team is starting a new project with Super Food, a chain of supermarkets across the country. Create a program for Super Food's point of sale system that uses their pricing scheme to calculate the total price for a number of items. Your code will become the core of a point of sale system, so make sure it represents your best code.

Remember: We're evaluating your design and development skills based on the code you give us. Make sure it reflects the type of code you'd write on a production software system for us. Take your time. Remember to refactor and write unit tests. If these instructions are unclear, rather than ask for clarification, list your assumptions and work from them.

The Rules

Each item at Super Foods is identified by a unique four-digit code. Today, pricing schemes at Super Foods use the following pricing categories, but beware: prices are constantly changing, and the sales department is always creating new incentives and deals.

Pricing Category Example Pricing Scheme
Simple A carton of milk (item #8873) costs $2.49
Buy X, Get Y Free Buy two toothbrushes (item #1983) for $1.99 each, get one free
Additional Taxes A bottle of wine (item #0923) costs $15.49 and is taxed an additional 9.25%
Bundled Chips and salsa (items #6732 and #4900) cost $4.99 together, but they cost $2.49 and $3.49 alone, respectively

Example

You can use any language you'd like, but the interface to your program should look like:

Checkout c = new Checkout(todaysScheme);
c.scan("1983"); // toothbrush
c.scan("4900"); // salsa
c.scan("8873"); // milk
c.scan("6732"); // chips
c.scan("0923"); // wine
c.scan("1983"); // toothbrush
c.scan("1983"); // toothbrush
c.scan("1983"); // toothbrush
int cents = c.getTotal();
assert 3037 == cents

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.