GithubHelp home page GithubHelp logo

pos-machine's Introduction

POS Project

POS cashier version: v1

Learning Objectives

  1. Practice Tasking;
  2. Practice JS collection operation;

Description of Requirements

A cash register (POS) system is used in the store for settlement of the store. This cashier will settle and print receipts at the time of settlement based on the item(Item) in the customers’ cart (Cart) and the ongoing promotion(Promotion) of the store.

It is known that the store is offering "buy two and get one free" for some products. One product has only one kind of preferential activity at the same time.

We need to implement a function called printReceipt, which can input the data of the specified format as a parameter and then output the text of the receipt in the browser console.

Input format (example):

[
  'ITEM000001',
  'ITEM000001',
  'ITEM000001',
  'ITEM000001',
  'ITEM000001',
  'ITEM000003-2',
  'ITEM000005',
  'ITEM000005',
  'ITEM000005'
]

For 'ITEM000003-2', what before""-"" is the standard barcode and what after ""-"" is the number, which may be a decimal. When we buy an item that needs to be weighed, such a tag is generated by a weighing machine, and the cashier is responsible for identifying the receipt.

Contents of the List (example):

***<store earning no money>Receipt ***
Name: Coca-Cola, Quantity: 3 bottles, Unit price: 3.00 (yuan), Subtotal: 6.00 (yuan)
Name: Badminton, Quantity: 5, Unit price: 1.00 (yuan), Subtotal: 4.00 (yuan)
Name: Apple, Quantity: 2 kg, Unit price: 5.50 (yuan), Subtotal: 11.00 (yuan)
----------------------
Total: 21.00 (yuan)
Saving: 4.00 (yuan)
**********************

Requirements on Assignment

  1. According to the test case in test/main-test.js, write the implementation code in the main/main.js file and make sure to pass the test;
  2. Please complete the homework with the minimum number of lines of code while ensuring the readability of the code;
  3. Please submit the completed homework to your GitHub repository;
  4. Please maintain good habits of code committing(Commit).

Tips on Assignment

  1. You can use the method loadAllItems()to get all the items.

  2. Use the method loadPromotions()to get all the promotion information.

pos-machine's People

Contributors

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