Skip to content

PrestonMonteWest/Calculator

Repository files navigation

Calculator

Introduction

Definitions

Function
Takes one or more arguments and evaluates to a single number
Operator
A mathematical function that has two arguments and is written in infix notation
Operand
A numerical argument to an operator
Expression
A syntactically correct string of numbers and operators
Result
The evaluation of an expression
Field
The text area that acts as a display for expressions
Precedence
Determines the order of operations

Purpose

The purpose of this document is to specify the requirements of the client-requested calculator. This document tries to state all necessary user and system requirements and will act as a guideline for system developers.

System Requirements

Properties

Compatible Platforms: Windows, Mac OS X, Linux
Language: Java SE 8

User Requirements

History

Up to 10 of the most recently evaluated expressions will be stored in a text file when the application is closed by the user. When the application is opened, that text file's existence is checked. If it exists, use it to initialize history; otherwise, start normally.

Operators

All conventional operations are supported along with the modulus operator as well. Below is a table that specifies each operation's related symbol and precedence. For precedence, 1 is the “highest”, and 3 is the “lowest”, and all operators are left associative.

Operator Symbol Precedence
Exponentiate ^ 1
Multiply * 2
Divide / 2
Modulo % 2
Add + 3
Subtract - 3

Output

Each result will be a decimal number with up to 10 digits of precision.

Functionality

  • When one of the six conversion functions is clicked, an appropriate expression will be generated as the last expression, and the result will be displayed in the field.
  • If the current expression is empty, all six conversion functions are disabled.
  • If the current expression is not the last expression, the “=” button is disabled.
  • The “Ans” button inserts the result of the previous calculation into the last expression.
  • The “Clr” button clears all expressions and the current result, if they exist.
  • The “Del” button deletes the last character in the last expression, if either exists.

About

A software engineering project to design a calculator.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages