Instructions
This is a reverse Polish notation, a.k.a. postfix, calculator.
Postfix is a mathematical notation in which the operators follow the operands.
This calculator will perform the following operations:
- Addition (+)
- Subtraction (-)
- Multiplication (*)
- Division (/)
Postfix notation does not require parentheses in mathematical expressions.
This calculator can process mathematical strings using only numbers along with +, - , *, and / symbols.
A valid input will have integer or floating point numbers and mathematical operators separated by spaces
in postfix form.
Example
The following is an example of an expression postfix notation. This example comes from Wikipedia.
The expression ((15 / (7 - (1 + 1))) * 3) - (2 + (1 + 1)) can be expressed with postfix notation as
15 7 1 1 + - / 3 * 2 1 1 + + -
This type of notation was commonly used in calculators because it was simple to implement using a
basic stack. This project attempts to replicate that behavior using JavaScript. To see how the calculator
is using the stack to solve a postfix expression, check "Show stack."
Technologies
HTML 5
This page uses HTML 5 for the main application body.
Bootstrap
Bootstrap is toolkit for developing applications with HTML, CSS, and JavaScript which allows for
the quick development of web applications without the need to implement all the fundamental
UI elements. It provides a number of classes and JavaScript elements used in this page.
JavaScript
The logic of this application is built on JavaScript. The project allowed me to familiarize myself
with JavaScript and the common libraries used for developing rich web applications.
JQuery
JQuery is a JavaScript library that provides a number of selectors and HTML document traversal mechanisms
which can be used to manipulate elements in an HTML document.
Popper.js
Popper.js is a small popup and tooltip library that allows for the easy creation of tooltips and popups for
web applications.
Glyphicons
Glyphicons is a collection of monochromatic icons. These are included in Bootstrap 3 and also available
here.
About
Author: Devon Smith
Created for CS460 at Western Oregon University, Fall 2017.
You can find the project description
here.