Вы находитесь на странице: 1из 2

Programming Principles & Artefacts

The main goal of structured programming is to Throw in wastebasket.


get an understanding about the flow of control in the }
given program text. In structure programming various
control structures such as switch-case, if-then-else, Repetition:
while, etc. allows a programmer to decode the flow of
the program easily. A repetition control structure will execute a block of
code several times based on some condition. In the
Sequencing: world of programming, we generally will use two
types of repetition control structures: counting and
It has to do with the logical sequence provided by conditional.
the statements in the program. As they are executed,
each step in the sequence must logically progress to Example 3: Count even numbers between 1 to 10.
the next without producing any undesirable effects.
Take counter to count even numbers
Example 1: Baking Bread For (Var A = 1; Var a <= 10; Var ++)  For Loop
{
Add flour, salt, yeast  Variables Check if number is even
Mix. If (number is even)  Conditional control
Add water. Counter ++
Knead.  Methods }
Let rise. Print value of counter for output.
Bake.
Modularization:
Selection:
Modular programming is the process of subdividing
It is also known as a conditional structure; a a computer program into separate sub-programs. A
selection structure is a programming feature that module is a separate software component. It can
performs different processes based on whether a often be used in a variety of applications and
Boolean condition is true or false. Selection structures functions with other components of the system.
use relational operators to test conditions. There are
different types of selection structures that can be Example3: Opening bank account
used to achieve different outcomes.
Class Bank {  Class
Example 2: Sorting Mail Open bank account {  Main Method
getDetails ();
Get mail from mailbox. typeOfReq ();
Put mail on table. procedure();
While (more mail to sort) disbursePackage();
{ }
Get piece of mail from table. Get the details of applicant (Personal details,
If (piece is personal) age, nationality) Checking age is in positive
Read it, number is  Constant
Else if (piece is magazine) Type of requirement for opening account
Put in magazine rack, (Savings, current)
Else if (piece is bill) Complete the procedure
Pay it, Provide applicant with details of account.
Else if (piece is junk mail) }
Programming Principles & Artefacts

Above steps are representation of bigger methods


that will be treated as separate modules for opening
account in the bank. These individual modules can be
reused with any other modules as per the
requirement.

References:
1. http://condor.depaul.edu/sjost/it236/docume
nts/structured.htm

2. https://www.webopedia.com/TERM/S/sequen
ce.html

3. https://www.webopedia.com/TERM/S/selectio
n.html

4. https://www.google.com

Вам также может понравиться