Flowchart - PowerPoint PPT Presentation

About This Presentation
Title:

Flowchart

Description:

DOWHILE. 15. END. How to get out. from the loop? id 0 ? y. n. START. INPUT id, name, sal ... DOWHILE. 39. START. X 10? A = A X. X = X 1. Y. N. 40. Quiz ... – PowerPoint PPT presentation

Number of Views:17
Avg rating:3.0/5.0
Slides: 58
Provided by: busT
Category:

less

Transcript and Presenter's Notes

Title: Flowchart


1
Flowchart
2
Basic
1 Tom 20000 2000 18000 2 Mary 25000 2500 225
00 3 Klien 30000 3000 27000 ...
INPUT id, name, sal
3
Basic
START
INPUT id, name, sal
tax sal .1 net sal - tax
PRINT id, name, sal, tax, net
END
4
Heading
ID NAME SALARY TAX NET -------------------------
----------------------------------------------- 1
Tom 20000 2000 18000 2 Mary 25000 2500 22500
3 Klien 30000 3000 27000
5
START
Heading
PRINT ID NAME SAL -----------
INPUT id, name, sal
tax sal .1 net sal - tax
PRINT id, name, sal, tax, net
END
6
START
Heading
PRINT heading
INPUT id, name, sal
tax sal .1 net sal - tax
PRINT id, name, sal, tax, net
END
7
User can change TAX RATE
START
1
2
INPUT id, name, sal
INPUT trate
3
tax sal .1 net sal - tax
4
PRINT id, name, sal, tax, net
5
END
8
User can change TAX RATE
START
INPUT trate
1
INPUT id, name, sal
tax sal trate net sal - tax
PRINT id, name, sal, tax, net
END
INPUT id, name, sal, trate
9
How to get out from the loop?
START
INPUT id, name, sal
tax sal .1 net sal - tax
PRINT id, name, sal, tax, net
END
10
How to get out from the loop?
START
1
2
y
n
id 0 ?
INPUT id, name, sal
D U M M Y
3
tax sal .1 net sal - tax
is the answer.
4
PRINT id, name, sal, tax, net
END
5
11
How to get out from the loop?
START
INPUT id, name, sal
3
y
id 0 ?
n
tax sal .1 net sal - tax
END
PRINT id, name, sal, tax, net
12
Iteration
  • DO WHILE LOOP
  • ???????????? ??????????? loop ??????
  • ??????????????????? loop ?????????? ???? (False)

Condition test
False
True
. . .
13
Iteration
  • DO UNTIL LOOP
  • ???????????? ??????????? loop ???????
  • ??????????????????? loop ?????????? ???? (True)

. . .
Condition test
True
False
14
How to get out from the loop?
START
n
id ltgt 0 ?
DOWHILE
y
INPUT id, name, sal
END
tax sal .1 net sal - tax
PRINT id, name, sal, tax, net
Condition PASS Position PASS Logic Fail
15
START
How to get out from the loop?
INPUT id, name, sal
n
DOWHILE
id ltgt 0 ?
y
tax sal .1 net sal - tax
END
PRINT id, name, sal, tax, net
Condition PASS Position PASS Logic PASS
INPUT id, name, sal
16
START
How to get out from the loop?
INPUT id, name, sal
DOUNTIL
tax sal .1 net sal - tax
PRINT id, name, sal, tax, net
INPUT id, name, sal
y
id 0 ?
END
n
17
Footing
1 Tom 20000 2000 18000 2 Mary 25000 2500 2
2500 3 Klien 30000 3000 27000 -----------------
--------------------------------------------------
----- Processed by MIS department
18
START
Footing
INPUT id, name, sal
n
id ltgt 0 ?
y
PRINT ------------- Processed by MIS
tax sal .1 net sal - tax
PRINT id, name, sal, tax, net
END
INPUT id, name, sal
19
ID NAME SALARY TAX NET ---------------------------
------------------------------- 1 Tom 20000 2000
18000 2 Mary 25000 2500 22500 3 Klien 30000 3000
27000 -------------------------------------------
--------------- Processed by MIS department
20
ACCUMLATION SUM
1 Tom 20000 2000 18000 2 Mary 25000 2500 2
2500 3 Klien 30000 3000 27000 -----------------
--------------------------------------------------
----- 67500
21
ACCUMLATION SUM
net sal - tax
tnet tnet net
22
START
ACCUMLATION SUM
INPUT id, name, sal
1
n
id ltgt 0 ?
6
y
2
tax sal .1 net sal - tax
END
3
PRINT id, name, sal, tax, net
tnet tnet net
4
INPUT id, name, sal
PRINT tnet
5
23
START
ACCUMLATION SUM
INPUT id, name, sal
n
id ltgt 0 ?
6
y
tax sal .1 net sal - tax tnet tnet net
PRINT tnet
3
tnet tnet net
PRINT id, name, sal, tax, net
END
INPUT id, name, sal
24
ACCUMLATION SUM
1 Tom 20000 2000 18000 2 Mary 25000 2500 2
2500 3 Klien 30000 3000 27000 -----------------
--------------------------------------------------
----- 75000 7500 67500
25
START
ACCUMLATION SUM
INPUT id, name, sal
n
id ltgt 0 ?
y
tax sal .1 net sal - tax
tnet tsal - ttax
tsal tsal sal ttax ttax tax
PRINT id, name, sal, tax, net
PRINT tsal, ttax, tnet
INPUT id, name, sal
END
26
ACCUMLATION SUM
1 Tom 20000 2000 18000 18000 2
Mary 25000 2500 22500 40500 3
Klien 30000 3000 27000 67500
27
START
ACCUMLATION SUM
INPUT id, name, sal
n
id ltgt 0 ?
y
tax sal .1 net sal - tax
END
tnet tnet net
PRINT id, name, sal, tax, net, tnet
tnet
INPUT id, name, sal
28
ACCUMLATION COUNT
1 Tom 20000 2000 18000 2 Mary 25000 2500 2
2500 3 Klien 30000 3000 27000 -----------------
--------------------------------------------------
----- counts 3
29
START
ACCUMLATION COUNT
INPUT id, name, sal
1
n
id ltgt 0 ?
6
y
2
tax sal .1 net sal - tax
END
3
PRINT id, name, sal, tax, net
count count 1
4
INPUT id, name, sal
PRINT count
5
30
ACCUMLATION SUM
Count count 1
31
START
ACCUMLATION COUNT
INPUT id, name, sal
n
id ltgt 0 ?
y
2
6
tax sal .1 net sal - tax count count 1
PRINT count
count count 1
3
PRINT id, name, sal, tax, net
END
4
INPUT id, name, sal
5
32
(No Transcript)
33
INPUT
ID NAME SALARY TAX NET -------------------------
----------------------------------------------- 1
Tom 20000 2000 18000 2 Mary 25000 2500 22500
3 Klien 30000 3000 27000 ---------------------
--------------------------------------------------
- counts 3
34
INPUT
ID NAME SALARY TAX NET -------------------------
----------------------------------------------- 1
Tom 20000 2000 18000 2 Mary 25000 2500 22500
3 Klien 30000 3000 27000 ---------------------
--------------------------------------------------
- counts 3
INPUT
OUTPUT
35
INPUT
ID NAME SALARY TAX NET -------------------------
----------------------------------------------- 1
Tom 20000 2000 18000 2 Mary 25000 2500 22500
3 Klien 30000 3000 27000 ---------------------
--------------------------------------------------
- counts 3
INPUT
OUTPUT
36
Iteration
  • DO WHILE LOOP
  • ???????????? ??????????? loop ??????
  • ??????????????????? loop ?????????? ???? (False)

Condition test
False
True
. . .
37
Iteration
  • DO UNTIL LOOP
  • ???????????? ??????????? loop ???????
  • ??????????????????? loop ?????????? ???? (True)

. . .
Condition test
True
False
38
START
INPUT id, name, sal
n
DOWHILE
id ltgt 0 ?
y
tax sal .1 net sal - tax
END
PRINT id, name, sal, tax, net
INPUT id, name, sal
39
START
N
X lt 10?
Y
A A X
X X 1
40
Quiz
  • ?????????????? flowchart ?????????????????????????
    ???
  • ID NAME G.P.A.
  • 101 Tom 3
  • 102 Mary 2
  • 103 Mike 4

Average GPA 3
41
(No Transcript)
42
Selection
  • DO WHILE LOOP
  • ???????????? ??????????? loop ??????
  • ??????????????????? loop ?????????? ???? (False)

True
False
Condition
. . .
. . .
43
Tax rate lt 10000 10 gt 10000 20
Selection
ID NAME SALARY TAX NET -------------------------
----------------------------------------------- 1
Tom 8000 800 7200 2 Mary 25000 5000 20
000 3 Klien 30000 6000 24000
44
START
Before any Selection
INPUT id, name, sal
n
id ltgt 0 ?
y
tax sal .1 net sal - tax
END
PRINT id, name, sal, tax, net
INPUT id, name, sal
45
After Selection
START
INPUT id, name, sal
n
id ltgt 0
y
y
n
sal lt 10000
y
END
tax sal .1
tax sal .2
net sal - tax
PRINT id, name, sal, tax, net
INPUT id, name, sal
46
Tax rate lt 10000 0 gt 10000 20
Selection
ID NAME SALARY TAX NET -------------------------
----------------------------------------------- 1
Tom 8000 0 7200 2 Mary 25000 5000
20000 3 Klien 30000 6000 24000
47
START
INPUT id, name, sal
n
id ltgt 0
y
y
n
sal lt 10000
y
tax 0
tax sal .2
net sal - tax
PRINT id, name, sal, tax, net
INPUT id, name, sal
A
48
START
START
INPUT id, name, sal
INPUT id, name, sal
n
n
id ltgt 0
id ltgt 0
y
y
y
n
y
n
sal lt 10000
y
sal lt 10000
y
tax 0
tax sal .2
tax sal .2
net sal - tax
net sal - tax
PRINT id, name, sal, tax, net
PRINT id, name, sal, tax, net
INPUT id, name, sal
INPUT id, name, sal
A
B
49
START
START
INPUT id, name, sal
INPUT id, name, sal
n
n
id ltgt 0
id ltgt 0
y
y
y
n
y
n
sal lt 10000
y
sal lt 10000
y
tax 0
tax sal .2
tax sal .2
net sal - tax
net sal - tax
PRINT id, name, sal, tax, net
PRINT id, name, sal, tax, net
INPUT id, name, sal
INPUT id, name, sal
A
B
50
Tax rate lt 10000 0 gt 10000 20 gt
30000 30
Selection
ID NAME SALARY TAX NET -------------------------
----------------------------------------------- 1
Tom 8000 0 7200 2 Mary 25000 5000
20000 3 Klien 30000 9000 24000
51
START
INPUT id, name, sal
n
id ltgt 0
y
sal lt 10000
y
n
y
sal lt 30000
tax 0
y
n
tax sal .2
tax sal .3
net sal - tax
PRINT id, name, sal, tax, net
INPUT id, name, sal
52
Tax rate lt 10000 0 gt 10000 20 gt
30000 30
Selection Sum
ID NAME SALARY TAX NET -------------------------
----------------------------------------------- 1
Tom 8000 0 7200 2 Mary 25000 5000
20000 3 Klien 30000 9000 24000 ----------------
--------------------------------------------------
------ 51200
53
n
id ltgt 0
y
PRINT tnet
sal lt 10000
y
n
y
END
sal lt 30000
tax 0
y
n
tax sal .2
tax sal .3
net sal - tax
tnet tnet net
PRINT id, name, sal, tax, net
INPUT id, name, sal
54
Tax rate lt 10000 0 gt 10000 20 gt
30000 30
Selection Count
ID NAME SALARY TAX NET -------------------------
----------------------------------------------- 1
Tom 8000 0 7200 2 Mary 25000 5000
20000 3 Klien 30000 9000 24000 ----------------
--------------------------------------------------
------ counts 3
55
n
id ltgt 0
y
PRINT count
sal lt 10000
y
n
y
END
sal lt 30000
tax 0
y
n
tax sal .2
tax sal .3
net sal - tax
count count 1
PRINT id, name, sal, tax, net
INPUT id, name, sal
56
Tax rate lt 10000 0 gt 10000 20 gt
30000 30
Selection Count
ID NAME SALARY TAX NET -------------------------
----------------------------------------------- 1
Tom 8000 0 7200 2 Mary 25000 5000
20000 3 Klien 30000 9000 24000 ----------------
--------------------------------------------------
------ counts 0 1 20 1 30 1
57
n
id ltgt 0
y
PRINT ct0, ct20, ct30
sal lt 10000
y
n
y
END
tax 0 ct0 ct0 1
sal lt 30000
y
n
tax sal .2 ct30 ct20 1
tax sal .2 ct20 ct20 1
net sal - tax
Write a Comment
User Comments (0)
About PowerShow.com