Code Monkey home page Code Monkey logo

node-pos-v0.1's Introduction

Node Js Get Started

Business Requirement

A cash register (POS) system is used in the store for 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 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):

[
    {
        Barcode: 'ITEM000000',
        Name: 'Coca-Cola',
        Unit: 'bottle',
        Price: 3.00

    },
    {
        Barcode: 'ITEM000000',
        Name: 'Coca-Cola',
        Unit: 'bottle',
        Price: 3.00
    },
    {
        Barcode: 'ITEM000000',
        Name: 'Coca-Cola',
        Unit: 'bottle',
        Price: 3.00
    },
    {
        Barcode: 'ITEM000000',
        Name: 'Coca-Cola',
        Unit: 'bottle',
        Price: 3.00
    },
    {
        Barcode: 'ITEM000000',
        Name: 'Coca-Cola',
        Unit: 'bottle',
        Price: 3.00
    },
    {
        Barcode: 'ITEM000001',
        Name: 'Sprite',
        Unit: 'bottle',
        Price: 3.00
    },
    {
        Barcode: 'ITEM000001',
        Name: 'Sprite',
        Unit: 'bottle',
        Price: 3.00
    },
    {
        Barcode: 'ITEM000004',
        Name: 'battery',
        Unit: 'a',
        Price: 2.00
    }
]

List contents (example):

***<store earning no money>Receipt ***
Name: Coca-Cola, Quantity: 5 bottles, Unit price: 3.00 (yuan), Subtotal: 15.00 (yuan)
Name: Sprite, Quantity: 2 bottles, Unit price: 3.00 (yuan), Subtotal: 6.00 (yuan)
Name: Battery, Quantity: 1 a, Unit price: 2.00 (yuan), Subtotal: 2.00 (yuan)
----------------------
Total: 23.00 (yuan)
**********************

Practice Challenge

  • How to export and import a module in node
  • What is npm and package.json
  • Why Javascript cannot run the in browser
  • Convert the basic description into a program as code
  • The use of loop nesting
  • Readable function and variable naming

Practice Requirement

  • Make all test pass by npm test

Environment

  • Node Js
  • NPM

Begin

Fork below repo to your own repo site in Github

https://github.com/tws-graduate-bootcamp/node-pos-v0.1

Open your terminal, change to any path and clone this repository:

git clone `forked repo site`

Install dependencies:

npm install

Run all tests:

npm test

Run a specific test file:

node_modules/jasmine/bin/jasmine.js spec/main-spec.js

You can find these two key folders when you open the repository with your favorite code editor:

spec  //Test code, stands for specifications
src   //Source code you should implementation

Practice Output && Submit

  • You should implement the code to pass all tests in spec folder, and push your repo to GitHub repo named node-pos-v0.1.
  • Commit your repository link to complete this Question.

Learning Resource

node-pos-v0.1's People

Contributors

aditobias avatar lxconan avatar zjx-immersion avatar

Watchers

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