How to Write a Calculator Simulator

by Simon Southwell
March 2004

Copyright © 2004 Simon Southwell. All rights reserved.


This article describes a method for constructing a simple on-line calculator simulator using HTML and JavaScript. No tools are required except a text editor, a browser (such as Internet Explorer or Netscape) and a bitmap manipulating tool such as MS Paint (though an additional tool is provided). An example is worked through from a bitmap image through to a working calculator. Methods are given for testing and debugging the code and the details of the code are described. The finished example is available for download. The text is fully illustrated, with 'active' diagrams where relevant, so that the progress of construction can be tried dynamically.

It is expected that the reader has some knowledge of the C or C++ programming language, and is not totally unknowledgable of HTML, though it is hoped most relevant aspects are covered in the text. As well as those wishing to simulate their own calculators, it is hoped the article will be of use as a working example for those interested in HTML and JavaScript in general. The appendix gives links for further HTML and JavaScript resources for any who wish to follow up the subject in more depth.

If you can't wait, sneak a peek at the finished example by clicking here.


"How to write a calculator simulator"
<- Prev Page  Next Page->