Professional Documents
Culture Documents
ONG ZU NI (1001850786)
Instruction: Answer ALL questions.
1- Draw Problem Analysis Chart (PAC), Interactivity Chart (IC), Input Output
Processing Chart (IPO), Algorithm and Flow Chart for the following questions:
(a) Given the radius r of a sphere, calculate the volume and area of the sphere.
volume = (4/3) * pi * r3
area = 4 * pi * r2
Interactivity Chart(IC)
MAIN
0000
CALC_VOLUME CALC_AREA
2100 2200
5. END
Algorithms Flowchart
Main module
1. Process READ MAIN
2. Process CALC_AREA
3. Process CALC_VOLUME
4. Process PRINT READ
5. END
CALC_AREA
CALC_VOLUME
END
Read module
1. READ r READ
2. EXIT
READ r
EXIT
CD206 BUSINESS PROGRAMMING (Tutorial 1)
CALC_VOLUME module
1. Volume = (4/3) * pi * r3 CALC_VOLUME
2. EXIT
Volume = (4/3) * pi * r3
EXIT
CALC_AREA module
1. Area = 4 * pi * r2 CALC_AREA
2. EXIT
Area = 4 * pi * r2
EXIT
Print module
1. PRINT Volume
PRINT
2. PRINT Area
3. EXIT
PRINT VOLUME
PRINT Area
EXIT
Interactivity Chart(IC)
MAIN
0000
END
n2>max
READ module
1. Read n1, n2, n3 READ
2. EXIT
n3>max
READ n1, n2, n3
EXIT
CALC module
1. max = n1
min = n2
2. identify max
if n2 > max
max = n2
if n3 > max
max = n3
3. identify min
if n2 < min
min = n2
if n3 < min
min = n3
4. EXIT
PRINT module
1. Print max and min
PRINT
2. EXIT
EXIT
CD206 BUSINESS PROGRAMMING (Tutorial 1)
the number of days (use 31 days for January / March / July / August / October /
December AND 30 days for April / June / September / November AND 28 days for
February (Non-leap year) AND 29 days for February (Leap year)) between two dates.
Interactivity Chart
MAIN
0000
3000
0000
Algorithms Flowchart
MAIN module
1. Process READ MAIN
2. Process CALC
3. Process PRINT
4. END READ
CALC
END
READ module
1. Read each months and days
2. EXIT
READ
EXIT
CD206 BUSINESS PROGRAMMING (Tutorial 1)
CALC module
1. if d2 > d1
CALC
days = d2 – d1 + 1
months = m2 – m1
else
if d1 > d2
days = 30 – d1 + 1 + d2
months = m2 – 1 – m1
else d2>d1
if d1 = d2 days = d2-d1+1 T
days = 1 months = m2-1-
months = m2 – m1 m1
2. EXIT
d1>d2 T
days = 30-d1+1+d2
months = m2-1-m1
d2=d1
T
days = 1
F
CD206 BUSINESS PROGRAMMING (Tutorial 1)
EXIT
PRINT module
1. Print months and days
2. EXIT PRINT
EXIT
d- An algorithm
- An algorithm is a set of instructions developed by programmer for a computer
- Setting up an algorithm is challenging as the instructions
cannot assume anything
cannot skip steps
must be executable one step at a time
must be complete
e- A flowchart
- A flowchart is a graphical representation used to show a step-by-step solution
using symbols which represent a task.
f- A pseudocode
- A pseudocode is an informal way of programming description that does not
require any strict programming language syntax or underlying technology
considerations.
END OF QUESTIONS