Skip to content

The project is centered on the design and implementation of a simple calculator for educational purpose.

License

Notifications You must be signed in to change notification settings

martyna-zyskowska/project-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project: Simple Calculator

The project is centered on the design and implementation of a simple calculator for educational purpose.

Table of Contents

General Info

The simple calculator project is focused on numbers and arithmetics operations. The end result of the calculator is to provide a correct result of mathematical operation.

Screenshots

calc_img

Technologies

Project is created with:

  • HTML5
  • CSS3
  • JS ES6

Status

Project is: in progress

Code Examples

function oper(value) {
  var result = document.getElementById("result");
  if (result.value.length !== 0) {
     var lastChar = result.value.slice(result.value.length-1);
     var regularExpression = /[0-9]/;
     var re = /^(\+|-|\*|\/|=|>|<|>=|<=|&|\||%|!|\^|\(|\))$/;
     if (lastChar.match(regularExpression) !== null) {
        result.value += value;
     }
     else if (lastChar.match(re) !== null) {
        result.value = result.value.slice(0, -1) + value;
     }
  }
}

Features

List of features ready and TODOs for future development

  • Mathematical operations are working as expected
  • Results of operations are correct (with the use of mathematical order of operations)
  • Operators cannot be entered more than once if the last character is not a number
  • if the user changes his or her mind and decide to change the operator, the calculator will replace the last character (for example from "+" to "-")
  • Decimal point or operators cannot be enterd if the result field is empty

To-do list:

  • Decimal point can be only provided once in one string
  • Evaluation after every operation (block mathematical order of operations)

Contributing

Contributions to the project library are welcome. Please note the following guidelines before submitting your pull request:

  • Follow JS coding standards
  • Write tests for new functions and added featues

License

MIT License: Copyright (c) 2018 Martyna Zyskowska

Author

Martyna Zyskowska

About

The project is centered on the design and implementation of a simple calculator for educational purpose.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published