You are on page 1of 14

PRINCIPLES OF PROGRAMMING

Course code: IT 101 Credit Hours: 3

INSTRUCTOR
Abiew Nuku Atta Kordzo
Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC
LECTURE THREE
PROGRAMMING
TOOLS

Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC


TOOLS FOR PROGRAMMING
• The design of a solution to a problem results in the creation of a program.
It is the program (resulting from the use of an appropriate programming
language’s syntax) that the user runs or uses to address his problem.
• In the process of designing the solution or creating the program, the
programmer uses programming tools to represent his logical steps to be
undertaken to achieve the desired objective.
• The following are some of the programming tools that are invariably used
for program design and documentation:
• Algorithms
• Pseudocode
• Flowchart

Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC


WHAT IS AN ALGORITHM?
• An algorithm is a written list or description of the solution to a particular
problem. It is a finite, step-by-step list of well defined instructions for
solving a particular problem. Thus:
Each step must be well defined – must not be ambiguous
The process must halt in a finite number of step, and finally,
The process must do what is claimed – it must solve the problem being addressed.
• In the simplest form, it could be single step of a mathematical expression
of a solution. For example, the algorithm for solving the quadratic equation
a𝔁2 + b𝔁 + c, is simply expressed as
−𝑏± 𝑏2 −4𝑎𝑐
𝒳 1,2 =
2𝑎
where a ≠ 0 (and b2 ≥ 4ac for real roots)
Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC
WHAT IS A PSEUDOCODE?
• It is a human-language like programmer’s shorthand outlining the
logical steps a module must follow or perform, (without commas or
any exact syntax) in order to solve a problem or address a particular
module in a bigger program.

• For an English speaking country like ours, it is an English like step-by-


step process describing logically how to carry out a specific task, but
not following any particular syntax.

Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC


WHAT IS A PROGRAM FLOWCHART?
• It is a graphical representation of the logical steps to taken in solving a
problem. Flowchart symbols are specific shapes used to create a
visual representation of a program.

• It is basically a collection of standard symbols and lines:


Boxes indicate what is to be done
Lines indicate the sequence of the boxes
Arrowheads on the lines indicate the direction of a program flow.

Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC


SOME COMMON STANDARD SYMBOLS

Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC


Example
• Present
a) a pseudocode
b) an algorithm
c) a flow chart
for calculating the area A, of a rectangle of length L, and breadth B.

Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC


PSEUDOCODE PRESENTATION
1. Start
2. Open area calculation module
3. Enter values for L and B
4. If L or B invalid, re-enter values
5. Else calculate Area
6. Display values of L, B and A
7. End if
8. End

Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC


ALGORITHM PRESENTATION
1. Read/Input values for L and B
2. Validate values for L and B
3. If either L or B is invalid go to step 1
4. Calculate Area A using formula A = L * B
5. Print values for L, B and A
6. Stop

Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC


FLOWCHART PRESENTATION

NO

YES

Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC


QUESTION TIME

Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC


Exercise
• Present algorithm, pseudocode and flowchart on the following
• Area of triangle
• Area of circle
• Body Mass Index
• Density of an object
• Use an algorithm or flowchart to outline how, in one program, you
will determine the area, diagonal or perimeter of any rectangle of
length L, and breadth B, for as many times as it desired.

Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC


Abiew Nuku Atta Kordzo (Systems Analysis: 2016) - GTUC

You might also like