Giter Site home page Giter Site logo

cash-register's Introduction

Cash Register

An exercise related to closures and js-calculator

Goal

Create an html5 single page app that looks like a cash register with these buttons. The cash register starts with $0.00 funds

[________________] <-----( display )

[7] [8]  [9]   [÷]  [clear]
[4] [5]  [6]   [×]  [get balance]
[1] [2]  [3]   [-]  [deposit cash]
[0] [00] [.]   [+]  [withdraw cash]
               [=]

( display ) is the primary ui that prints all results
[clear] will clear the display
[get balance] will display the current balance
[deposit cash] will add the amount currently in the ( display ) to the cash register, then clears the display
[withdraw cash] will remove the amount currently in the ( display ) to the cash register, then clears the display

calculator.js

Write all calculator logic in calculator.js using the revealing module pattern
The module should be named Calculator and should only be concerned with performing mathematical computation.

cash_register.js

Write the rest of the logic to perform the necessary functions to achieve the goal.
You may create modules within cash_register.js in order to separate concerns.
For example, the function of updating the ( display ) should be handled in one place, or one module, instead of interweaved throughout the spaghetti.

index.html

Write all html5 markup in index.html
You should import ./js/calculator.js and ./js/cash_register.js at the bottom of your <body> tag.

Running the app

you must have live-server installed, if not then install it npm i -g live-server

from your project directory run

live-server

cash-register's People

Contributors

theremix avatar joekarlsson avatar sgnl 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.