Giter VIP home page Giter VIP logo

java-technical-assignment's Introduction

QMetric Java Exercise

Our Java coding exercise is inspired by PragDave Supermaket Kata.

[...] to experiment with various models for representing money and prices that are flexible enough to deal with [a variety of] pricing schemes, and at the same time are generally usable (at the checkout, for stock management, order entry, and so on).

The task

This project provides the code for an initial model of a supermarket. The supermarket's inventory consists of products that can be sold by unit (e.g. a can of baked beans) or by weight (e.g. loose carrots). The total price of a shopping basket has currently been calculated as a simple sum of its items.

The supermarket would like to offer pricing discount schemes, for example:

  • Buy one, get one free
  • Buy two items for £1
  • Buy three items for the price of two
  • Buy one kilo of vegetables for half price

Some discounts would be applicable for single products (e.g. a can of baked beans), while others could apply across a group of products (e.g. vegetables).

Your task is to extend the functionality of Basket to implement a component that can calculate the total amount to pay for the items in a basket, including any discounts that would be applicable for the current state of the basket.

  • You should think about how the relationships between Basket, Item, and Product will need to be refactored to achieve this
  • You should consider how your solution could be extended to provide more complicated discount schemes

First and foremost this is an opportunity for you to demonstrate your software design skills within a small problem space.

Please read through the description carefully and implement a solution that includes at least one of the pricing discount schemes described.

We would like you spend no more than one hour on this task.

We are looking for...

  • Clean, tidy, tested, and working code (with accurate pricing calculations)
  • Use of appropriate design patterns and SOLID principles
  • Small incremental changes with good comments, as demonstrated in your commit history

Above all, we would rather see a small codebase with fewer features than failure to observe the points above.

You may add any libraries you feel are appropriate. But we don't expect to see databases or other persistence layers, dependency injection frameworks, web servers, REST APIs, or web frameworks; we are not looking for a fully functioning supermarket system!

Tips

  • Plan your time before you start coding. Start small and add features incrementally
  • Focus on the pricing model and the behaviour of your components -- you only need to demonstrate that your design works, rather than an exhaustive model of numerous supermarket items
  • If you run out of time, describe your intentions in the NOTES.md file

We really don't want you to over-engineer the solution -- and you really don't have time for that! -- but be prepared to extend the functionality in the next step of the interview process.

Submission

Clone or fork this project into a publicly accessible git repository of your own, and email the URL to to [email protected].

Good Luck!

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.