GithubHelp home page GithubHelp logo

pos_v1_english-2019-9-25-9-33-1-129's Introduction

POS Project v1

POS Cash Register Version:v1

Teaching Objectives

  1. The basic syntax familiar with JavaScript;
  2. Familiar with JavaScript basic logic statements and keywords;

Description of Requirement

The store will use the cash register (POS) systems when shopping settlement, This cashier will settle and print the receipt (Receipt) according to the item in the customer's shopping cart (Cart) And ongoing promotions at the store(Promotion)at the time of settlement .

The store is offering a "buy two get one free" offer for some products. One item has one and only one kind of promotion at the same time.

We need to implement a function called printReceipt, This function can input 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'
]

Which for 'ITEM000003-2',Before "-" is the standard barcode, After the "-" is the quantity, The number may be a decimal. When we buy items that we need to weigh,These tags (Tag) will be generated by the weighing machine, The cash register is responsible for identifying the receipt。

List Contents(example):

***<store earning no money>Receipt ***
Name:Coca-Cola,Quantity:3 bottles,Unit:3.00(yuan),Subtotal:6.00(yuan)
Name:Badminton,Quantity:5 a,Unit:1.00(yuan),Subtotal:4.00(yuan)
Name:Apple,Quantity:2 pounds,Unit:5.50(yuan),Subtotal:11.00(yuan)
----------------------
Total:21.00(yuan)
Discounted prices:4.00(yuan)
**********************
  1. Homework requirements

    1. According to the test case in test/main-test.js,Write the implementation code in the main/main.js file and make sure the test passes;
    2. Please complete the assignment with the least number of lines of code as much as possible while ensuring the readability of the code;
    3. Run the run.html file below the file to make the test pass;

Homework Reminder

  1. Use the loadAllItems() method to get all the items, This method returns the result as an array containing the item objects.(example):

    [ item1, item2, item3, ..., itemN ]
    
  2. The structure of each commodity object is as follows(example):

    {
       barcode: 'ITEM000000',
       name: 'Coca-Cola',
       unit: 'bottle',
       price: 3.00
    }
  3. Use the loadPromotions() method to get all the promotion information, This method returns the result as an array containing the promotion information object (example):

    [
       {
         type: 'BUY_TWO_GET_ONE_FREE',
         barcodes: [
           'ITEM000000',
           'ITEM000001'
         ]
       },
       {
         type: 'OTHER_PROMOTION',
         barcodes: [
           'ITEM000003',
           'ITEM000004'
         ]
       }
    ]
  4. You should learn and be good at using the Console feature in the developer tools that come with the popular browsers.

pos_v1_english-2019-9-25-9-33-1-129's People

Contributors

linwenjun avatar

Watchers

 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.