/IMY-772-Calculator

A very simple calculator app for an individual workshop assignment for my honours module, IMY 772, to demonstrate application of test-driven development processes and git workflow.

Primary LanguageTypeScriptCreative Commons Zero v1.0 UniversalCC0-1.0

IMY-772-Calculator

Goal

The calculator app should be able to perform basic arithmetic functions (addition, subtraction, multiplication and division) on a set of hexadecimal numbers. The restrictions for the calculator is that it will only take inputs of up to 3 digits, return answers up to 6 digits, not return any negative answers, and not return any answers with decimal places.

Contents

Functional Requirements

Category Functional Requirements
Arithmetic Operations Addition
Subtraction
Multiplication
Division
Input and Output Limit input to 3-digit hexadecimal values
Limit output to non-negative, whole, 6-digit, hexadecimal values
Display input as hexadecimal value equations
Display output as hexadecimal values
Allow values and operations to be input by pressing buttons
Error Handling and Limitations Display error for /0
Display error for / Disallow input > 3 digits
Display absolute value of output (disallow negative output)
Disallow values > 6 digits
Display error for / Disallow decimal places in input
Limit calculations to one operator and two operands at a time (disallow chaining)
Disallow answers to be used as input in the next equation (since these are likely > 3 digits)
Disallow evaluation of empty / incomplete equations
UI Buttons for letters A-F
Buttons for 0-9
Buttons for +,-,/,*
Button to backspace / clear value
Button to clear equation
Button to submit (equals)

Optional Extras

  • Allow values and operations to be input via keyboard
  • Store every calculation and answer in a database
  • Allow a user to view calculation history
  • Display hex values (input, output) as colours Please note you need to be part of the University of Pretoria to access.

Video

The link to the demonstration video is here: demonstration video

Development server

This project was generated with Angular CLI version 17.3.7.

Run ng serve for a dev server. Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run npm run test:cypress to execute the end-to-end / UI tests via cypress.