Code Monkey home page Code Monkey logo

supermarket's Introduction

supermarket

A Supermarket Register CLI application which can take a set of product codes, look up the price of each product, and compute the total amount of the sale (including local sales tax).

Features:

  • Initial products supported can be modified in config/products.json.
  • List products
  • Add a product
  • Remove a product
  • Calculate total amount of sale of selected products (including local sales tax)
  • Save register products.

Requirements

Docker (Tested with Docker version 17.05.0-ce, build 89658be)

Building/Testing

To run unit tests and build the application:

# Using Makefile
make build

# Using docker explicitly
docker build -t supermarket .

Running

(Optional) Set environment variable SKUS to a string of products codes separated by semicolons. This will be used to calculate total amount of sale.

e.g.

export SKUS="E5T6-9UI3-TH15-QR88; YRT6-72AS-K736-L4AR"

To run the application:

# Using Makefile
make run

# Using docker explicitly
docker run -e SKUS="${SKUS}" -it supermarket

To start an exited application and continue from it's last saved state:

docker start -i <CONTAINER_ID>

An example of the Supermarket CLI Application running:

1. List products
2. Add a product
3. Remove a product
4. Calculate total of products
5. Save and exit
Select option:
1
E5T6-9UI3-TH15-QR88 {'product': 'Chicken', 'price': 8.18}
65P1-UDGM-XH2M-LQW2 {'product': 'Tuna', 'price': 5.89}
A12T-4GH7-QPL9-3N4M {'product': 'Cereal', 'price': 3.46}
YRT6-72AS-K736-L4AR {'product': 'Pop', 'price': 1.63}
TQ4C-VV6T-75ZX-1RMR {'product': 'Pizza', 'price': 6.78}

supermarket's People

Contributors

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