LOAD DEPOSIT
ADD INTEREST
STORE TOTALINVESTMENT
The simplest of tasks in assembly language required too many instructions to be accomplished.
In seeking a solution, high-level languages (HLLs) were developed in which single English-like
statements could be written to accomplish multiple tasks. Translator programs called compilers
were developed to convert high-level language programs into machine language. The program
segment written above is coded below using high-level language format:
Developing business applications using high-level languages proved to be very difficult and
tedious. To solve this problem, Fourth-generation languages (4GLs) were developed. They
provide a window-based programmer interface and wizards that allow for the rapid creation of
database tables, forms and reports. Visual FoxPro® and Access® are examples of 4GLs.
CaFSET (Antigua) Office Workbook. Written by Richard and Jessie Lewis © 2009 by CaFSET (Antigua) 267
Introduction to Programming Lesson 1: Introduction to Programming Concepts
Problem Partitioning
Problem partitioning is the process of dividing a problem into input, processing, and output. Let
us look at a programming problem that accepts two numbers, adds them, and prints the total.
This problem is partitioned as follows:
The following example calculates and prints the average of three (3) scores for a student. The
problem is partitioned as follows:
Algorithms
An algorithm is a series of instructions that are executed in a specific order. Specifying the order
in which statements are to be executed in a computer program is called program control. An
algorithm can be represented using pseudocode or flowcharts.
The syntax of an algorithm or a program refers to the characters, signs or symbols which are
combined to produce a program statement. The semantics of an algorithm or a program refer to
the meaning derived from the combination of characters, signs or symbols.
Pseudocode
Pseudocode is an informal language (using everyday English) that programmers use to develop
algorithms. Pseudocode is not an actual programming language and as such cannot be executed
by the computer. The algorithm must be converted to a language such as C++ or Pascal.
CaFSET (Antigua) Office Workbook. Written by Richard and Jessie Lewis © 2009 by CaFSET (Antigua) 268
Introduction to Programming Lesson 1: Introduction to Programming Concepts
Input Statement
The READ command is one of the statements used to accept data from the user. For example, to
accept or store a number, you write the statement:
Read (number)
The following example shows the Print and Read statements in use:
The last statement prints the value stored in the variable “number”.
Flowcharts
A flowchart is a graphical representation of an algorithm. Flowcharts are used to show data flow
through a series of symbols and lines showing directional flow. Flowcharts are used in program
design to illustrate the logic of the program. The main flowchart symbols are:
Connector (used to break a data flow line that flows to another page)
Let us use a flowchart to outline the steps in solving a simple programming problem.
Problem: Accept two numbers from the user (A and B), and print “Numbers are equal” if A
is equal to B. Otherwise, print “Numbers are not equal”. Using a flowchart, give
a solution for this problem.
CaFSET (Antigua) Office Workbook. Written by Richard and Jessie Lewis © 2009 by CaFSET (Antigua) 269
Introduction to Programming Lesson 1: Introduction to Programming Concepts
Start
Prompt and
Input A, B
True
If A = B
False
Output
“Numbers are
not equal”
Output
“Numbers are
equal”
End
Operators are used with operands. 9 * 7 has two operands (9 and 7) and one operator (*).
Logical Operators
&& AND
|| OR
! NOT
CaFSET (Antigua) Office Workbook. Written by Richard and Jessie Lewis © 2009 by CaFSET (Antigua) 270