Giter Site home page Giter Site logo

calculator's Introduction

Calculator

Rule 1: Don't divide by zero.

Live demo ๐Ÿ‘ˆ

Functionality

An online calculator made with Javascript.

  • Chain multiple basic operations with the ร—, รท, +, and โˆ’ buttons.
  • Finish a calculation with the = button and continue again with the above operators.
  • Clear all with the 'AC' button and delete a recent input with the 'DEL' button.
  • All the above, along with numerical input, can be done via both mouse clicks and keyboard.
  • Decimal output is rounded to 2 decimal points for simplicity and to aviod screen overflow.
  • In progress calculations are displayed above the main output section of the screen for usability purposes.

Reflection

This project surprised me with the amount of funcitons that were required for proper functionality and it felt like everytime I fixed one issue two more appeared in the process. Some examples of problems I hadn't considered of during the pseudocode stage included:

  • Removing the ability of the user to click the delete button following an = operation and begin deleteing parts of the answers.
  • Reusing an answer again following = when the user wants to continue operating on the output.
  • Repeating operations when the = button is repeatedly pressed but not when the operator buttons are repeatedly pressed.

The final Javascript definitely could be optimized further and some of the functionality was implemented using what may not be best practices (i.e. counter used to handle consecutive operator buttons) and could be fine tuned later with additional practice in the language.

-Greg Olive

calculator's People

Contributors

gregolive avatar

Watchers

 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.