0% found this document useful (0 votes)
15 views40 pages

04 Data Modeling Techniques

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views40 pages

04 Data Modeling Techniques

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

DATA MODELING TECHNIQUES CHAPTER 04

CHAPTER 04
FLOW CHARTS Data Modeling Techniques
WHAT IS A FLOWCHART?
START

Display message
“How many
hours did you
work?”

A flowchart is a diagram Read Hours

that depicts the “flow” of Display message

a program. “How much do


you get paid per
hour?”

The figure shown here is


a flowchart for the pay- Read Pay Rate

calculating program Multiply Hours


by Pay Rate.
Store result in
Gross Pay.

Display Gross
Pay

END
Rounded

BASIC FLOWCHART SYMBOLS


START Rectangle

Display message
“How many
hours did you
work?”

Notice there are three Read Hours

types of symbols in this Display message

flowchart: “How much do


you get paid per Parallelogram
hour?”
 rounded rectangles
 parallelograms Read Pay Rate

 a rectangle
Multiply Hours
by Pay Rate.
Each symbol represents a Rectangle Store result in
Gross Pay.
different type of
operation. Rounded
Display Gross
Pay
Rectangle
END
Terminal

BASIC FLOWCHART SYMBOLS


START

Display message
“How many
hours did you
work?”

Terminals Read Hours

 represented by rounded Display message


rectangles “How much do
you get paid per
 indicate a starting or ending hour?”

point
Read Pay Rate

Multiply Hours
by Pay Rate.
START Store result in
Gross Pay.

Display Gross
Pay

END Terminal
END
BASIC FLOWCHART SYMBOLS START

Display message
“How many
hours did you
work?”

Input/Output Operations Read Hours

 represented by parallelograms Display message


 indicate an input or output “How much do
you get paid per
Input/Output
Operation
operation hour?”

Read Pay Rate

Multiply Hours
by Pay Rate.
Display message Store result in
Gross Pay.
“How many
Read Hours
hours did you Display Gross

work?” Pay

END
BASIC FLOWCHART SYMBOLS
START

Display message
“How many
hours did you
work?”

Processes Read Hours

 represented by rectangles Display message


 indicates a process such as a “How much do
you get paid per
mathematical computation or hour?”

variable assignment
Read Pay Rate

Multiply Hours
by Pay Rate.
Process Store result in
Multiply Hours Gross Pay.
by Pay Rate.
Store result in Display Gross
Pay
Gross Pay.
END
STEPPING THROUGH THE START
Output

FLOWCHART
Display message Operation
“How many
hours did you
work?”

Read Hours
How many
hours did
you work?
Display message
“How much do
you get paid per
hour?”

Read Pay Rate

Multiply Hours
by Pay Rate.
Store result in
Variable Contents: Gross Pay.

Hours: ? Display Gross


Pay Rate: ? Pay

Gross Pay: ? END


STEPPING THROUGH THE START

FLOWCHART
Display message
“How many
hours did you
work?”

How many
Input Read Hours
hours did Operation
you work?
(User types Display message
40
40) “How much do
you get paid per
hour?”

Read Pay Rate

Multiply Hours
by Pay Rate.
Store result in
Variable Contents: Gross Pay.

Hours: 40
Display Gross
Pay Rate: ? Pay

Gross Pay: ? END


STEPPING THROUGH THE START

FLOWCHART
Display message
“How many
hours did you
work?”

Read Hours
How much
do you get
paid per
Display message
hour?
“How much do
Output you get paid per
Operation hour?”

Read Pay Rate

Multiply Hours
by Pay Rate.
Store result in
Variable Contents: Gross Pay.

Hours: 40
Display Gross
Pay Rate: ? Pay

Gross Pay: ? END


STEPPING THROUGH THE START

FLOWCHART
Display message
“How many
hours did you
work?”

Read Hours
How much
do you get
paid per
Display message
hour? 20
“How much do
you get paid per
hour?”

Input Read Pay Rate


Operation
(User types Multiply Hours
20) by Pay Rate.
Store result in
Variable Contents: Gross Pay.

Hours: 40
Display Gross
Pay Rate: 20 Pay

Gross Pay: ? END


STEPPING THROUGH THE START

FLOWCHART
Display message
“How many
hours did you
work?”

Read Hours
How much
do you get
paid per
Display message
hour?
“How much do
you get paid per
hour?”

Read Pay Rate

Multiply Hours
Process: The by Pay Rate.
Store result in
Variable Contents: product of 40
times 20 is
Gross Pay.

Hours: 40 stored in
Gross Pay Display Gross
Pay Rate: 20 Pay

Gross Pay: 800 END


STEPPING THROUGH THE START

FLOWCHART
Display message
“How many
hours did you
work?”

Read Hours
Your gross
pay is 800
Display message
“How much do
you get paid per
hour?”

Read Pay Rate

Multiply Hours
by Pay Rate.
Store result in
Variable Contents: Gross Pay.

Hours: 40
Output Display Gross
Pay Rate: 20 Operation Pay

Gross Pay: 800 END


FOUR FLOWCHART STRUCTURES

❖ Sequence
❖ Decision
❖ Repetition
❖ Case
SEQUENCE STRUCTURE

a series of actions are performed in sequence


The pay-calculating example was a sequence
flowchart.
DECISION STRUCTURE

One of two possible actions is taken, depending


on a condition.
DECISION STRUCTURE

A new symbol, the diamond, indicates a yes/no question.


If the answer to the question is yes, the flow follows one
path. If the answer is no, the flow follows another path

NO YES
DECISION STRUCTURE

In the flowchart segment below, the question “is x < y?” is


asked. If the answer is no, then process A is performed. If
the answer is yes, then process B is performed.

NO YES
x < y?

Process A Process B
DECISION STRUCTURE

The flowchart segment below shows how a decision


structure is expressed in Java as an if/else statement.
Flowchart Java Code

NO YES if (x < y)
x < y? a = x * 2;
else
Calculate a Calculate a a = x + y;
as x plus y. as x times 2.
DECISION STRUCTURE

The flowchart segment below shows a decision structure


with only one action to perform. It is expressed as an if
statement in Java code.
Flowchart Java Code

NO YES if (x < y)
x < y? a = x * 2;

Calculate a
as x times 2.
REPETITION STRUCTURE

Notice the use of the diamond symbol. A loop tests a


condition, and if the condition exists, it performs an action.
Then it tests the condition again. If the condition still exists,
the action is repeated. This continues until the condition no
longer exists.
REPETITION STRUCTURE

In the flowchart segment, the question “is x < y?” is asked.


If the answer is yes, then Process A is performed. The
question “is x < y?” is asked again. Process A is repeated
as long as x is less than y. When x is no longer less than y,
the repetition stops and the structure is exited.

YES
x < y? Process A
CONTROLLING A REPETITION STRUCTURE

By adding an action within the repetition that changes the


value of x.

YES
x < y? Display x Add 1 to x
A PRE-TEST REPETITION STRUCTURE

In a pre-test repetition structure, if the condition does not


exist, the loop will never begin.

YES
x < y? Display x Add 1 to x
A POST-TEST REPETITION STRUCTURE

This flowchart segment shows a post-test


repetition structure. Display x
The condition is tested AFTER the actions
are performed.
Add 1 to x
A post-test repetition structure always
performs its actions at least once.
YES
x < y?
CASE STRUCTURE
CASE STRUCTURE

One of several possible actions is taken, depending on


the contents of a variable.

The structure below indicates actions to perform


depending on the value in years_employed.
CASE STRUCTURE

If years_employed = 2, If years_employed = 3,
bonus is set to 200 bonus is set to 400
If years_employed = 1, If years_employed is
CASE
bonus is set to 100 years_employed any other value, bonus
is set to 800

1 2 3 Other

bonus = 100 bonus = 200 bonus = 400 bonus = 800


CONNECTORS
Sometimes a flowchart will not fit on one page.
A connector (represented by a small circle) allows you to connect two
flowchart segments.

A
CONNECTORS

•The “A” connector


A
indicates that the second START

flowchart segment begins


where the first segment
ends.

END
A
ANSWER
What do each of the following symbols represent?

Decision
Terminal

Input/Output
Operation Connector

Process Module
CONTEXT DIAGRAMS CHAPTER 04
Data Modeling Techniques
(DFD 0)
WHAT ARE CONTEXT DIAGRAMS?
❖ A context diagram outlines how external entities
interact with an internal software system.

❖ It’s primarily used to help businesses wrap their heads


around the scope of a system. As a result, they can figure
out how best to design a new system and its
requirements or how to improve an existing system.

❖ Context diagrams are high-level diagrams, meaning


they don’t go into the detailed ins and outs of the
system. Instead, they map out an entire system in a way
that’s simple, clear, and easy to understand.
WHAT IS DIFFERENCE BETWEEN DFD LEVEL 0
DIAGRAM AND CONTEXT DIAGRAM?
❖ Context diagrams and data flow diagrams are often used
interchangeably, but they aren’t the same. There are key differences
between using the two.
Context diagrams focus on how external entities interact with your
system. It’s the most basic form of a data flow diagram, providing a
broad view of the system and external entities in an easily digestible
way. Because of its simplicity, it’s sometimes called a level 0 data
flow diagram.
Data flow diagrams contain additional information about a system
that a context diagram doesn’t. They focus on how your system
works (the inputs, outputs, and processes) to offer more detail and
depth. With the help of a data flow diagram tool teams can visualize
the four main components of a system: the entities, processes, data
stores, and data flows.
EXTERNAL ENTITY

❖A producer or consumer of data

❖Examples: a person, a device, a sensor


❖Another example: computer-based
system
❖Data must always originate
somewhere and must always be sent
to something
PROCESS

A data transformer (changes input


to output)

Examples: compute taxes, determine


area, format report, display graph

Data must always be processed in some


way to achieve system function
DATA STORE
Data is often stored for later use.

sensor #
sensor #, type,
look-up location, age
sensor
report required data
type,
location, age
sensor number

sensor data

38
DATA FLOW
Data flows through a system, beginning
as input and transformed into output.

Data Flow
base
compute
triangle area

height area

39

You might also like