Giter VIP home page Giter VIP logo

jm-dono-basket's Introduction

CODING ASSIGNMENT

Write a program and associated unit tests that can price a basket of goods, accounting for special offers.

The goods that can be purchased, which are all priced in GBP, are: • Soup – 65p per tin • Bread – 80p per loaf • Milk – £1.30 per bottle • Apples – £1.00 per bag

Current special offers are: • Apples have 10% off their normal price this week • Buy 2 tins of soup and get a loaf of bread for half price

The program should accept a list of items in the basket and output the subtotal, the special offer discounts and the final price.

Input should be via the command line in the form

PriceBasket item1 item2 item3

For example: PriceBasket Apples Milk Bread

Output should be to the console, for example:

Subtotal: £3.10 
Apples 10% off: -10p 
Total: £3.00 

If no special offers are applicable, the code should output:

Subtotal: £1.30 (no offers available) 
Total: £1.30 

The code and design should meet these requirements but be sufficiently flexible to allow for future extensibility. The code should be well structured, suitably commented, have error handling and be tested.

jm-dono-basket's People

Contributors

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