Loading...

Loading...

Basic Calculator

Requirements

Description
November 14, 2022

Seen in this web page a simple calculator HTML mark up with two mathematical function which is Addition and Subtraction.

Usage: Enter a number and press either the + or - button to perform the desired computation and then press = to obtain the results. To perform another calculation, press the C button to clear memory.

Tech notes: There are two scripts classes.js and index.js. The calculator script is written in a JavaScript class in the filename classes.js and instantiated in index.js. There are two methods available for mathematical operations in the Calculator class namely

  • add()
  • subtract()
You have also the constructor method and other helper methods:
  • constructor()
  • getOperationResults()
  • displayResults()
  • getInput()
  • setCalculatorOperation()
  • cls()
Lastly, the Calculator class has the ff: attributes:
  • result
  • calMem
  • operations
  • input

Requirement 1
November 14, 2022

Clone the repository in your local machine. Create another branch with this format your_last_name-your_firtname_develop

Requirement 2
November 14, 2022

After cloning, create two additional methods for the Calculator class for the remaining two math operations. That will be for Multiplication and Division.

Requirement 3
November 14, 2022

Modify the UI and create 0 up 9 button keys which when pressed will be the input for the desired math operation. The input should be displayed in the text field (the calculator screen)

Requirement 4
November 14, 2022

Bind the +, -, *, /, c or C and = or "Enter" keys to the appropriate operation. <Pressing Enter should give your the results>. Example when button "5", "+", "6", "=" were pressed in that particular order, the result should be 11 (shown in the text field). And pressing "C" or "c" will clear the memory.

Requriement 5
November 14, 2022

Create a custom Clock class that will implement a method (or methods) to format the clock into 12-hr format and 24-hr format. You will need to provide the additional UI for toggling the clock format.

Requriement 6
November 14, 2022

Push your your_last_name-your_firtname_develop branch and create a pull request to the useracceptance branch.