Michael KwayisiΞ

EasyCalc: A GUI Java scientific calculator

Twitter · Facebook
A Graphical User Interface scientific calculator written in Java. It has a multi-line display and can evaluate basic and complex scientific expressions that contain logarithmic, exponential, and/or trigonometric functions.Designed to perform basic and scientific computations

EasyCalc is a Graphical User Interface (GUI) scientific calculator written in Java. It has a multi-line display and can evaluate many scientific expressions containing logarithmic, exponential, and/or trigonometric functions. It sports a nice and clean interface similar to that of the Windows 7 calculator. I wrote this program as part of my project requirements during my study at NIIT. I do not recommend its usage for any mathematical operation as it has some flaws left unfixed. It is presented here for academic purposes only. The complete source code and compiled binaries are available for download below.


Being a scientific calculator, EasyCalc allows you to perform all the basic arithmetic operations, and several other complex mathematical operations. It also support a few basic statistical operations. Things that are missing from the calculator are quick access to common constants like pi, e, etc. However, it comes packed with operational features like arbitrary floating point arithmetic, multiple number systems (binary, octal, decimal and hexadecimal), logarithmic, trigonometric, and exponential functions, etc.

  • Standard/Scientific modes

    EasyCalc starts in Standard mode which allows you to perform only the basic arithmetic operations (addition, subtraction, multiplication, division, modulus, reciprocal, and square roots), but one can switch to Scientific mode which allows more complex operations. In Scientific mode you can type expressions using functions like sin, cos, tan, log, ln (natural log), int (integral), factorial, cube root, exponentials, statistical operations (sum and average), etc. The calculator honors operator precedence in both Standard and Scientific modes.

  • Operator precedence

    EasyCalc takes the order of operation into account for all calculations. So expressions like 2 + 3 * 4 will yield 14 rather than 20. According to the math that I know, exponents are at the top of the order of precedence (of course behind parenthesis) so an expression like 4 ^ 3 ^ 2 should be evaluated right-to-left as in 4 ^ (3 ^ 2) yielding 262,144. However most scientific calculators ignore this rule, evaluating left-to-right to yield an incorrect 4,096. EasyCalc obeys the rule here. The order of operator precedence implemented in EasyCalc is {roots, powers, reciprocal, factorial}, {functions (sin, cos, tan, log, nl, etc.)}, {explicit multiplicative operators}, {additive operators}, and {implicit multiplication}.

  • Postfix input method

    The postfix input method allows you to type expressions just like you would write them on paper. For example, if you want to evaluate the expression sin 30, using Windows Calculator, it will require you to type the operand (30) first, and afterwards hit the sin function. In contrast, EasyCalc is declarative, allowing you to type expressions as is. So, for more complex expressions like 2 sin 30, you would type it as is without going through the imperative process of inputting it as sin(30) * 2. Having said that, expressions like 2 sin 30 + 5! will give a tricky result of 241 instead of the expected 121. This is because implicit multiplications (in this case 2 * sin(30)) are evaluated last in the order of operations.

  • Multifarious features

    EasyCalc supports calculations in four number systems: binary, octal, decimal and hexadecimal. You can perform any operation in any number system you choose, something that even many commercial calculators don't support. The application starts in decimal mode but you can switch to other number systems by clicking on the appropriate button. Other useful features built into EasyCalc are digit grouping (for all number systems), temporal data storage and retrieval, and copying unto the clipboard. These features are either accessible from the menu bar of the application or directly from the application workarea.

Building the project

Compiling this project's source code should be hassle-free. I compiled mine with JDK 1.7.0_02 but I'm pretty confident that compiling with any other JDK beyond 1.5 will be successful as well.

Using make

If you have GNU make (my favorite flavor and the one that I wrote the project's makefile for), then building the project is just a piece of cake because of the already-present makefile in the project. This will free you from all the hassles of locating where the source files are and how they are related. You can make all (or simply make) to compile the source code and create a jar archive as well. Other phony targets in the file are the ubiquitous clean, debug (to generate debugging info) and release (to generate no debugging info).

Without make

If you do not have make, or your flavor of it can't read the makefile properly, or for some reason you need to compile it manually, just know that all the source code files are in the src directory which is at the root of the project. In the same directory is the manifest file named MANIFEST.MF, which you must include in your Java archive, that is, if you are creating one. Compiling the project is just like any other ordinary Java project. Nonetheless, should you encounter any problems, you may contact me for assistance.


easycalc-0.0.2.zipEasycalc 0.0.2 executable jar file16.81 KB
easycalc-0.0.2-src.zipEasycalc 0.0.2 complete source code16.15 KB

The license that comes with this software (both the source code and compiled binaries) allows you to distribute, remix, tweak, and build upon your work, even commercially, as long as you credit the author for the original creation. See the in-package LICENSE.txt for additional information.

NOTE: The fonts used in the already compiled programs are Lucida Sans Unicode, Verdana, and Cambria Math. Since Java applications are cross-platform, folks on operating systems other than Microsoft Windows, where some of the above-mentioned fonts may not be installed, may experience a slight visual displeasure. In this setting, you are encouraged to download the source code and modify the fonts to suit your visual styles preferences.

Comments (9)

  1. MaryamMaryam
    Dec 1, 2013 15:49 GMT

    Brilliant work !

  2. SolestySolesty
    Apr 18, 2014 05:57 GMT

    That's my boss. #Applaudise

  3. Bonsa TesfaBonsa Tesfa
    Jan 10, 2015 09:35 GMT

    I appreciate you and would like to say may God help you to do more!!!!!!!!

  4. Shahid RahmanShahid Rahman
    Feb 18, 2015 16:17 GMT

    How to develop a scientific calculator which have some function like as cube, subtract, sum, product, division, square, sin, cos, tan, and so on.

  5. johnsonjohnson
    Jul 13, 2015 17:24 GMT

    brilliant work

  6. JayloThaiJayloThai
    Jan 20, 2016 01:50 GMT

    this..so much GOOD

  7. Noman MehmoodNoman Mehmood
    Apr 20, 2016 08:28 GMT

    Excellent Work

  8. jerryjerry
    May 21, 2016 03:40 GMT

    what is the purpose of the "1st", "u" and "clr" keys on the easycalc

    1. Michael KwayisiMichael Kwayisi
      May 21, 2016 18:33 GMT

      They are statistical functions that allow you to add numbers to a list ("lst", contraction of "list"), find the mean/average of the numbers in your list ("u", the Greek letter mu), the sum of the numbers in the list (the sigma letter), or clear/reset the list ("clr"). The number in the space just above the mu key tells you the current number of items in your list.

NOTE: You are replying to 's comment. [Cancel]