Calculator - Step 2. Core Business Logic

Objective for this step

In this step, we will put in all the core business logic. At the end of this step, you will have a fully functional calculator.

By "core", we mean it will function, provided the user don't key in anything funny, such as "1.2.3 * + 456". We will put in the validation checks in Step 3.

The Steps

To make the codes easier to understand, and to "similulate" the actual process when developing a php-gtk application, we will break this down into a number of sub-steps. At each step, you will always have a fully runnable script - that's the beauty of a script language!

    2.1 Process the numbers

    2.2 Process the binary operators (+-*/) and equal sign (=)

    2.3 Process the unary operators: sqrt, %, 1/x and +/-

    2.4 Process the rest of the buttons

We will first process just the button clicks first, then move on to process keyboard inputs.

    2.5 Process keyboard inputs

Links

Search This Site

Google
Web This Site

Search PHP-GTK2 Manual

Full-text search on php-gtk2 manual

Members Login

Username:
Password:
Key:
What is this?
  Forget Password?