Skip to content

Challenge-Calculator: Javascript implementation of calculator state machine

Notifications You must be signed in to change notification settings

suvelocity/calculator-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Challenge-Calculator

Welcome! looks like our calculter broke down, please help us fix it!

how to start?

  1. clone the repo to your computer
  2. run npm i on your terminal
  3. start coding!
  4. at the end it should look like this: operation

Template instructions

In the template file you will get 2 components.
MathOperation - should get {type , onClick(function)} as props.
DigitButton - should get {value(0-9) , onClick(function)} as props.

  • You can use operationTypes array to check what values are expected as props for MathOperation component.

Requirements:

  1. Calculator must have 20 buttons
  2. Should contain all numbers between 0-9 and a dot (.)
  3. AC button that clears the result screen
  4. Equal button (=), after pressing equal you should make sure you can use the result in the next calculation.
  5. It should also have a sqrt (√) and power (x²) buttons
  6. The calculator should return "Error" when the user tries to divide by zero
  7. The calculator should have the following functions:
  • divide / (9/2 = 4.5)
  • sum + (9+2 = 11)
  • minus - (9-2 = 7)
  • multiply * (9*2 = 18)
  • modulo % (9%2 = 1)
  • power x² (3² = 9)
  • sqrt √x (√16 = 4)
  1. You should be able to do complicated operations (9*2 = 18 => 18 % 4 = 2 => 2 * 2 = 4) complicated-operations

important!

In order to make the tests run properly, do not change the id's of the components, and make sure to use the right types and values!

  • Its recommended to open windows calculator and check its behaviour, they should act the same.

final result

your result should look something like this
calculator

How to submit?

Just upload the link to your repoistory to our website, and we will check if your code has fixed our calculator!

Review

Please review our challenge so we could improve it! https://forms.gle/kruou5hvSL6DFQma9

About

Challenge-Calculator: Javascript implementation of calculator state machine

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published