Git Product home page Git Product logo

pos_v0.2-2019-6-13-7-37-30-583's Introduction

POS Project v0.2

POS收银机 版本:v0.2

教学目标

  1. 学会把基本描述转换成程序;
  2. 能够驾驭三个循环;

需求描述

商店里进行购物结算时会使用收银机(POS)系统,这台收银机会在结算时根据客户的购物车(Cart)中的商品(Item)进行结算和打印收据(Receipt)。

我们需要实现一个名为printReceipt函数,该函数能够将指定格式的数据作为参数输入,然后在浏览器的控制台中输出收据的文本。

输入格式(样例):

[
  'ITEM000000',
  'ITEM000000',
  'ITEM000000',
  'ITEM000000',
  'ITEM000000',
  'ITEM000001',
  'ITEM000001',
  'ITEM000004'
]

清单内容(样例):

***<没钱赚商店>收据***
名称:可口可乐,数量:5瓶,单价:3.00(元),小计:15.00(元)
名称:雪碧,数量:2瓶,单价:3.00(元),小计:6.00(元)
名称:电池,数量:1个,单价:2.00(元),小计:2.00(元)
----------------------
总计:23.00(元)
**********************

作业要求

  1. 根据test/main-test.js中的测试用例,在main/main.js文件中编写实现代码并确保测试通过;
  2. 请在保证代码可读性的前提下,尽可能用最少的代码行数完成作业;
  3. 运行文件下面的run.html文,使测试通过

作业提示

  1. 学会遍历查找内容

pos_v0.2-2019-6-13-7-37-30-583's People

Contributors

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