Upload
isaac-collins
View
217
Download
0
Tags:
Embed Size (px)
Citation preview
Structured Programming (4 Credits)
HNDIT11034
Module Aims & objectivesEnhance skills for the
development of application programmes through systematic problem solving skills
Learning OutcomesApply systematic approach to
problem solvingUse appropriate data types for
representation of data within a programme
Use appropriate control structures for defining logical instruction flow
Demonstrate basic programme testing skills inclusive of debugging and tracing.
Assessment and Weighting
• Continuous Assessment Tutorials and lab assignments related to classroom teaching - 25%
• Mini programming project 25%
• End of semester examination Structured written paper 50%
Week 1 – Learning OutcomesDefine a computer programExplain what is programmingDescribe the importance of
programs and programmingDescribe the evolution of
programmingDesign an algorithmic solution for
simple problem such as computation of a factorial, total of a series etc. using flow charts
• A computer program is a set of instructions or commands, which tell the computer what to do.
• A computer language is a set of symbols and rules used in constructing programs.
• Computer languages are used to develop application programs
Introduction
7
Program Development Life Cycle
Six main phases1. Define the problem2. Design the solution3. Code the program4. Test the program5. Document the program6. Implement the program
Source Code Object CodeTranslator
Low Level Language
High Level Language
1st Generation
2nd Generation
3rd Generation
4th Generation
5th Generation
Computer Language
• First and second generation languages are considered low level languages.
• They are machine dependant languages
• These languages are close to the hardware
• The programmer should have hardware knowledge to write a program
• Productivity is low
Low Level Languages
High Level Languages
• 3GL,4GL and 5GL are considered high level languages
• They are machine independent languages
• It is easy to write and modify • The programmer does not need
knowledge of hardware to write programs
• Productivity is high• Consume less time to write
programs• Translators need to be used to
convert to machine language
12
Design the Solution
Design an algorithm. An algorithm is a finite series of logical
steps required to solve a particular problem. Finite means that the beginning and end are
clearly defined.
13
Flowcharting
A flowchart is a pictorial representation of an algorithm or logical steps.
Each step is represented by a symbol and the arrows indicate the flow and order of the steps.
The shape of the symbol indicates the type of operation that is to occur.
14
Basic Flowchart Symbols
Begin or End Input or Output
Processing Decision
Branch or Direction of Flow
15
Flow Control Structures
Flow control is the order in which statements are executed.
There are four control structures. 1. Sequence Control 2. Selection Control
Also referred to as branching (if and if-else)
3. Repetition Control (loops)
16
Sequence Control
17
Selection Control (branching)
18
Repetition Control (loops)
Flowchart for ProcessingCredit Orders
Entersalesorder
Approvedfor credit?
Rejectorder
Inventoryavailable?
Back-order
Fill order Stop
Start
No
Yes
Yes
No
Draw a flow chart to cross the road.
Are clear both
ways?
Go to pavement
No
Cross the road Wait
Yes
Start
Stop
Look at left & right
Draw a flow chart to find the correct key from a bunch keys to open the door.
Can the door be opened
Tryout a key
No
Try the next key
Yes
Start
Stop
DiscussionHow to apply flowchart to design
solution for a computational problems. (Discuss few from the lab sheet)
Q & A