MyCalculator is a calculator that I built from scratch. It allows addition, subtraction, multiplication, division, use of brackets and percentages (with % symbol), as well as squaring and using square roots.
The correctness of the expression is checked while typing; for example, user cannot start an expression with a closing bracket.
Initially, this project was a practice in using different Java Swing layouts and other GUI elements. Later, I decided to add the expression evaluation and it turned out this part was much more interesting to work on.
When evaluating the expression, the program first generates a corresponding binary tree. The internal nodes of the tree store operations symbols and the external nodes store the numbers. Then the tree is traversed to produce the numeric result of the expression.
The calculator, including binary trees and binary tree evaluator, was made entirely without using any external libraries.
You can find the project here.