Continue ........

II)  Pseudocode

    Pseudocode (pronounced 'soo-doh-code') is a sequence of English-like statements that represent an algorithm. The term 'code' refers to a computer program. Therefore, representing an algorithm in pseudocode means that the algorithm is written using a language similar to a programming language.

    There are no standard rules for writing pseudocode. Individual freedom is allowed. The widely accepted convention is to use indentation to clarify the statement blocks. Pseudocode can be constructed as an outline of a program so that it is easy to convert the algorithm into program codes at a later stage.

Stepwise refinement may also be applied to pseudocode as in the two examples below:

The intial algorithm is as follows:
1) Get data
2) Calculate wage
3) output total wage
 
 

First level refinement
1)  Get data 
     1.1)  Get number of hours worked 
     1.2)  Get hourly rate 

2)  Calculate wage 
     2.1)  Calculate regular wage 
     2.2)  Calculate overtime allowance 
     2.3)  Calculate total wage 

3)  Output total wage

 
 
Second level refinement
1)  Get data 
     1.1)  Get number of hours worked 
     1.2)  Get hourly rate 

2)  Calculate wage 
     2.1)  Calculate regular wage 
     2.2)  Calculate overtime allowance 

            2.2.1)  Calculate number of overtime hours 
            2.2.2)  If overtime hours > 0 
                       then calculate allowance 
                       else set allowance to 0 
      2.3)  Calculate total wage 

3)  Output total wage

 

III)   Program flowchats

    The importance of program flowchat is declining because this tool is not suitable for complex algorithms
 
 

 
PROCESS  BOX 
TERMINAL BOX 
CONNECTOR 
FLOW   LINE
DECISION BOX
PREDEFINED PROCESS BOX 
 
 
 
~~~~  The program flowchat for the payroll problem ~~~~