Git Product home page Git Product logo

pos-machine-v2-2020-10-27-8-39-8-963's Introduction

Business Requirement

A cash register (POS) system is used in the store for the settlement of the store. This cashier will settle and print the receipt (Receipt) according to the item(Item) in the customer's shopping cart (Cart) at the time of settlement.

We need to implement a function called printReceipt, which can receive barcodes and then output the text of the receipt.

This time, the input will be an array of barcodes (string). For example:

[
  "ITEM000000",
  "ITEM000000",
  "ITEM000000",
  "ITEM000000",
  "ITEM000000",
  "ITEM000001",
  "ITEM000001",
  "ITEM000004"
]

Then the output should be

***<store earning no money>Receipt ***
Name: Coca-Cola, Quantity: 5, Unit price: 3 (yuan), Subtotal: 15 (yuan)
Name: Sprite, Quantity: 2, Unit price: 3 (yuan), Subtotal: 6 (yuan)
Name: Battery, Quantity: 1, Unit price: 2 (yuan), Subtotal: 2 (yuan)
----------------------
Total: 23 (yuan)
**********************

Suppose that :

[
   {
      "barcode": "ITEM000000",
      "name": "Coca-Cola",
      "price": 3
    },
    {
      "barcode": "ITEM000001",
      "name": "Sprite",
      "price": 3
    },
    {
      "barcode": "ITEM000002",
      "name": "Apple",
      "price": 5
    },
    {
      "barcode": "ITEM000003",
      "name": "Litchi",
      "price": 15
    },
    {
      "barcode": "ITEM000004",
      "name": "Battery",
      "price": 2
    },
    {
      "barcode": "ITEM000005",
      "name": "Instant Noodles",
      "price": 4
    }
]

Practice Requirement

  1. Please draw the whole tasking diagram.
  2. Please declare all the functions according to your diagram.
  3. Please write a test case following given...when...then pattern for a leaf block of the diagram. Then implement the block to pass the test.
  4. Please repeat step 3 until all functions are implemented.

pos-machine-v2-2020-10-27-8-39-8-963's People

Contributors

linwenjun avatar

Watchers

James Cloos avatar  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.