Title: Why Flowchart
1Why Flowchart?
- Lets explore the reasons we should flowchart.
2Its a graphic representation of the algorithm
- A flowchart shows the flow of processing from the
beginning to the end of the solution. - It is the single most important step in
organizing a solution to the problem. - Instructions in a flowchart symbol are generic
rather than specific to any particular language.
3Errors
- Logic errors can be identified much more easily
in a flowchart than in actual code. - You can test the algorithm prior to writing code.
- After the programmer has spent hours writing code
is no time to discover a logic problem that may
force him to return to the very beginning of
program design - the flowchart.
4Terminal Symbol
- Indicates the start and end of a function.
- Use the word end or stop for the Main Function.
- Use begin and the function name.
- Use the words exit or return for all other
functions.
Start
End
5Processing
- Used to indicate any kind of processing such as
calculations, copying data, incrementing
counters, etc.
A BC
6Input/Output
- Indicates input to and output from the computer
memory. - Some words that are used here include READ,
INPUT, SCAN, DISPLAY, PRINT, GET, WRITE, ACCEPT.
GET length of room in inches.
7Decision Statement
- Indicates a logical (TRUE or FALSE).
- It should have only 1 entrance and only 2 exits.
- Put the question in the box and show the
direction of the decisions.
Install?
yes
no
8Predefined Process
- Represents a function and is placed in the
calling function. - A function has only 1 entrance and 1 exit.
- The name of the function should be used in the
start terminal symbol.
Dimensions
Begin Dimensions
9Loop Control
Initialize B
- Represents a loop with a counter.
- The counter starts with B (the beginning value),
is incremented by S (the incrementing value),
until the counter is greater than E (the ending
value).
BBS
Is BgtE?
no
yes
10Page Connectors
- The circle connects sections on the same page.
- The plate connects flowcharts from page to page.
- Letters or numbers are written inside to connect
to a corresponding letter or number in a
different area.
A
B
11The Sequence Structure
12The Double Decision Structure
13The Single Decision Structure
14The Repeat-Until Structure
15The While Structure
16The Case Structure
17Lets Flowchart
Write a program to calculate the cost of carpet
for a room. Get dimensions of the room from the
user. Allow the user to choose from three
different carpets. The price of the given
carpets are per square foot. Charge 8 tax. If
they want installation add 0.50 per square foot.
Display all information known for the customer
to see.