Giter VIP home page Giter VIP logo

receipt's Introduction

receipt

An application for generating receipt details of shopping baskets

Prerequisites

  • Python 3.7+

The application was only tested on Windows, but should work on other OS as well. If using a different OS than Windows, some of the commands for installation may differ.

Installation

This installation guide is written for Windows and assumes that the commands are excuted inside a powershell. For other OS use the corresponding commands.

Clone the repository

git clone https://github.com/marcelhohn/receipt.git

Change into the project directory

chdir receipt

Optional: Create a virtual environment and activate it

This assumes python is in your PATH.

python -m venv env
.\env\Scripts\Activate.ps1

For other commands for activating the virtual environment depending on your platform and shell see the python doumentation on venv.

Install the application

pip install .

Usage

Run the application from anywhere on your system via

receipt input

where input is the path to the input file.

Example

Assume we are in the same directory as the file input.txt, which has the following content:

1 book at 12.49
1 music CD at 14.99
1 chocolate bar at 0.85

Then running the application prints out the receipt details to the console:

> receipt input.txt
1 book: 12.49
1 music CD: 16.49
1 chocolate bar: 0.85
Sales Taxes: 1.50
Total: 29.83

Assumptions

The application handles only one input file at once. The input file is expected to consist of multiple lines, one line for each item. Each line is expected to contain the following information in the following order:

  • An integer number indicating the quantity of that item
  • A description containing the name of the item and the word "imported" (anywhere in the description), if (and only if) the item is imported
  • The word "at"
  • A number with two decimals and a dot (".") as decimal separator indicating the shelf price for all units of that item (e.g. the line "2 books at 20.00" means that both books together have a shelf price of 20.00)

Each of the above contents are separated with exactly one space character.


Developer's guide

Install dev dependencies

Create and activate a virtual environment as explained above.

Install the package and its dependencies:

pip install -e .[dev] 

Run the tests

python -m unittest

receipt's People

Contributors

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