Programming a calculator in Delphi Essay Example
Programming a calculator in Delphi Essay Example

Programming a calculator in Delphi Essay Example

Available Only on StudyHippo
  • Pages: 4 (852 words)
  • Published: December 11, 2017
  • Type: Essay
View Entire Sample
Text preview

The aim is to produce a fully working calculator program that incorporates as many mathematical features as possible. The program is to be created using Delphi, an IDE based on the Pascal language. I personally prefer to program in C++ as I have quite a lot of experience with it. However, this seems a worthwhile opportunity to develop my skills in Delphi, of which I have used in the past, and have found it to be a very useful language especially for creating small utilities (such as calculators) and database-orientated applications.

At first, it's unusual programming in Delphi after using C++ for so many of my past programming projects (and also Java, which has fairly similar syntax to C++). However, it's been pretty easy to get back into familiarity with the language. Pascal is quite a bit s

...

impler than C++ and so it hasn't been much of a problem at all. It's just a matter of getting some of the small differences correct, such as assigning variables and syntax order. In fact, I have enjoyed using Delphi quite a lot; I especially like the ease of use of 'procedures'. They are quite a lot easier to implement than some of the complex 'functions' used in the C/C++ programming languages.

DesignThis project can be as simple or as complicated as I'd like to make it. Sometimes keeping it simple is best - a nice, clean interface with a fully working, yet simple, calculator is much better than a bug-ridden calculator with a messy interface, which includes numerous advanced features that don't work properly. I'll have to try and get the correct balance between each. Obviously the more features

View entire sample
Join StudyHippo to see entire essay

I can implement into the calculator (for example, square rooting, trigonometric ratios, memory features) then the better, but I need to make sure that they work properly and that they don't hinder the reliability of the program in any way.

The first thing I need to do is get the simplest form of a calculator up and running: a calculator that can add, subtract, multiply and divide. This in itself can take some time, but once I have accomplished this then I have a firm base from which to expand and include further features. My main aim (apart from getting it to actually work!) is to make the programming as tidy and efficient as possible. Instead of having messy, hard to read code, I want to try to make the code progressive and easy to follow.

To do this, I intend to comment my code thoroughly where needed. The calculations involved may well get rather complicated hence I will try and organise the code to the best of my ability.The first thing that comes to light when designing the calculator is the layout. I need to decide what I'd like on the calculator, and specify what each button is to do. Designing the calculator like this beforehand will pay off later when it comes round to the coding.

Included overleaf is an initial sketch of how I'd like the calculator to appear and work in its simplest form. Obviously, the further I get into the project, the more likely my initial design is to change as I implement further features, or change things that don't fit for some reason etc.Now that I've got a small idea

in my head of how I want the calculator to look, I can get on with the initial implementation phase. This will basically involve creating the layout of the calculator in Delphi. At that point, I will take a screenshot of the calculator and then advance from there.Also, I've decided to call the calculator 'Easy Calculator v1.

0'. This is a good, simple name, and I've included a version number in case I'd like to produce a newer version of the finished program in the future (yeah right :)).Annotated sketch of Simple Calculator (1st Draft)ProblemsBelow is a screenshot of an early stage in the development of the calculator:So far, all that has been considered is the layout and preparation for the proper coding that is to come to add functionality to the calculator. In the screenshot, there is a 'basic' layout of the calculator, which includes all the features that you would expect in any standard calculator.

Also included is a Main Menu at the top of the page, which is empty at the moment, but will be filled later for further interactivity and ease of use. Already, the initial design has changed slightly.All the objects on the form have been given suitable names so that they are easily identifiable and so that it's easier to work with.Now it's time to get dirty and into some proper programming! I would like to start off by getting the basic features working first. After analysing the problems presented, I've managed to put together a list of the problems that need to be solved in order to get the basic calculator up and running on the following page.

Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New