Skip to content

Latest commit

 

History

History

calculator

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Calculator

Level: Beginner

Calculators are not only one of the most useful tools, but also a great way to understand the UI and event handling in an application. In this task, you will create a calculator that supports basic arithmetic calculations on integers.

The style is up to you, so use your imagination and get creative!

You cannot use the eval() function to do calculations

User stories

  • The user can see a display that shows the current number entered or the result of the last operation.
  • The user can see a notepad with buttons for entering numbers 0-9, operations - '+', '-', '/' and '=', a 'C' button (to clear) and an 'AC' button (to clear all).
  • The user can enter digits as sequences of up to 8 digits by pressing the digits in the pad. Entering any digits longer than 8 will be ignored.
  • The user can press the operation button to display the result of that operation: the result of the previous operation and the last digit entered OR The last two numbers OR entered the last digit entered
  • The user can press the "C" button to clear the last number or the last operation. If the user's last entry was an operation, the display will be updated to the value that preceded it.
  • The user can press the 'AC' button to clear all internal work areas and set the display to 0.
  • The user may see 'ERR' on the display if any operation exceeds the 8-digit maximum.

Additional Functions.

  • The user can press the '+/-' button to change the sign of the currently displayed number.
  • The user can see a decimal point button ('.') on the input panel, which allows floating point numbers up to 3 digits and operations with the maximum number of decimal places entered for any one number.

Useful links and resources

Wikipedia

Design

Design for calculator

UI for calculator

Project examples

BHMBS - JS-Neumorphic-Calculator

Javascript iOS Style Calculator

Javascript Calculator

React Calculator

Javascript-CALC