You are on page 1of 23

BMS 201

Computer
programming
STEPS IN PROGRAM DEVELOPMENT
 Generate program objectives/Problem Defn
 Design program / Algorithm Development
 Write the program Code/Coding
 Compile the code
 Execute or run the program
 Test and debug the program
 Maintenance and modification
 Documentation of Software
FLOWCHART DEVELOPMENT
 Flowcharts are Pictorial representation of the program
logic
 They help analyze the problem in more effective way.
 Program flowcharts serve as a good program

documentation.
 Act as a guide during the systems analysis and program

development phase.
 The flowchart helps in debugging process.
 Provides means of communication with others about

the program
TYPES OF FLOW CHARTS

 Document flowcharts: showing a document


flow through a system
 Data flowcharts: showing data flows in a

system
 System flowcharts: showing controls at a

physical or resource level


 Program flowchart: showing the controls in a

program within a system


FLOWCHART SYMBOLS

 Start/ Stop Symbol: this is depicted


using an elliptical or a rectangle with
rounded corners symbol. Shows the
beginning and end of the flowchart
 Diagram
FLOWCHART SYMBOLS
 Process / Computational Symbol:
This is represented using a
rectangular symbol; and the type of
the process or computation is written
inside the symbol
 Diagram
FLOWCHART SYMBOLS
 Input / Output Symbol: This is
depicted by a parallelogram-like
symbol as shown below. Captures
input and output into the flowchart
 Diagram
FLOWCHART SYMBOLS
 Decision Symbol: A decision –
making point is represented using a
diamond symbol. Used for making
selection or taking alternatives in
decision making
 Diagram
FLOWCHART SYMBOLS
 Connector Symbol: This is
represented with a circular symbol, in
which two parts of a program
flowchart join or connect.
 Diagram
FLOWCHART SYMBOLS
 Flow line: This is depicted by using
a straight line with an arrow at the
end. It shows the direction of flow in
a program.
 Diagram
FLOWCHART SYMBOLS
 Off – Page Connector: This symbol
enables a programmer to connect to a
flowchart that is continued into a
second or another page, and is shown
using a trapezium
 Diagram
GUIDELINES FOR DRAWING A
FLOWCHART
 In drawing a proper flowchart, all necessary
requirements should be listed out in logical
order.
 The flowchart should be clear, neat and easy to

follow. There should not be any room for


ambiguity in understanding the flowchart.
 The usual direction of the flow of a procedure

or system is from left to right or top to bottom.


GUIDELINES FOR DRAWING A FLOWCHART

 Only one flow line should come out from a


process symbol
 Only one flow line should enter a decision

symbol, but two or three flow lines, one for


each possible answer, should leave the
decision symbol.
 Only one flow line is used in conjunction with

terminal symbol.
1. Start
2. Product = 1
3. Count = 0
4. Input number Num
5. Sum = Sum + Num
6. Count = Count + 1
7. If Count < 35 then
8. Go to step 4
9. Else
10. Print Sum
11. End if
12. End
GUIDELINES FOR DRAWING A FLOWCHART

 Write within standard symbols briefly.


 For complex flowchart use connector symbols to

reduce the number of flow lines.


 Avoid the intersection of flow lines
 Ensure that the flowchart has a logical start and end.
 It is useful to test the validity of the flowchart by

passing through it with a simple test data. Dry Running


FLOWCHARTING EXAMPLES

 Example 1
 Write an algorithm that can be used in calculating and

outputting the sum of the first 35 natural numbers


 Convert the algorithm mentioned in (a) above into a

flowchart
 Draw a flowchart to find the largest of three numbers

A, B and C.
1. Start
2. Sum = 0
3. Count = 0
4. Input number Num
5. Sum = Sum + Num
6. Count = Count + 1
7. If Count < 3 then
8. Go to step 4
9. Else
10. Print sum
11. End if
12. End
LIMITATIONS OF USING FLOWCHARTS

 Complex logic: The program logic can be


quite complicated making the flowchart
complex and clumsy.
 Modifications: if alterations are required the

flowchart may require re-drawing completely.


 Reliability: the essentials of what is done can

easily be lost in the technical details of how it


is done.
Flowchart Exercises
 As a programmer, you are told to write a program for
computing the sum of the first 20 positive integers. The
program is supposed to output the sum after computing
 Write an algorithm for performing the above task
 Rewrite the above algorithm using the flowchart

method
ALGORITHM
1. Start
2. Num = 0
3. Sum = 0
4. Sum = sum + num
5. Num = num + 1
6. If num <= 20 then
7. Go to step 4
8. Else
9. Print sum
10. Stop
Flow Chart Exercises
 A supermarket is planning to give discounts to its
customers based on the total costs of purchases made by
the customer. Discounts are given as follows:
 Total sales exceeding 5000/=, discount is 8%
 Sales greater than 3000/= and less than 5000/=, discount
is 5%
 Sales greater than or equal to 1500/= and less than
3000/=, discount is 2%
 Sales less than 1500/=, no discount
 Required: Develop an algorithm and draw up a flowchart
for a program that can be used to control this process
ALGORITHM
1. Begin
2. Get Totsale (Total Sales)
3. If Totsale > 5000 then
4. Discount = 8% * Totsale
5. Elseif Totsale >=3000 and Totsale < 5000 then
6. Discount = 5% * Totsale
7. Elseif Totsale >=1500 and Totsale < 3000 then
8. Discount = 2% *Totsale
9. Else
10. Discount =0
11. Print Totsales
12. Print Discount
13. End

You might also like