Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
• Effective analysis
– Problem can be analyzed in more effective way.
• Proper documentation
– Serves as good program documentation which is needed
for various purposes.
Advantage of using Flowchart
• Efficient Coding
– Acts as guide or blueprint during systems analysis and
program development phase.
• Proper Debugging
– Helps in debugging process.
• Off-page connector
• Process Process
Off-Page
• Input/Output Input /
Output • Predefined process /Call
function Predefined
Process
• Decision / If Decision
Common Symbols
• Looping / Repetition • Document
Document
While
• Data File
For
Database
Do
Machine Problem #1
• Create a simple flowchart that displays “Hello
World” on the screen.
Main
End
Machine Problem #2
• Create a flowchart that inputs two integer numbers.
Compute and display the sum of the two numbers on
the screen. A B
Main
Output Sum = N1 + N2
“Enter first number”
Integer N1
Output
Input N1
Sum
Integer N2
Output
End
“Enter second number”
Integer Sum
Input N2
A
B
Machine Problem #3
• Create a flowchart that allows user to input the radius
of the circle. Compute and display the area of the
circle.
Main x
Integer R Input R
Output Output
“Input radius” “Area:” & Area
x End
Some guidelines in flowcharting:
• In drawing a flowchart, all necessary requirements
should be listed out in logical order.
• Flowchart should be clear, neat and easy to follow.
No room for ambiguity in understanding it.
• Usual direction of the flow of a procedure or system
is from left to right or top to bottom.
• Test validity of the flowchart by passing through it
with a simple test data.
Available Flowchart Tools
Drawing Programs Visual Programming
• Dia languages
• Flowgorithm
• yEd
• Raptor
• Inkscape • LARP
• Visual Logic
• Microsoft Visio
• VisiRule
• Free programming language that is based on simple
graphical flowcharts.
Save as MP1.fprg
Do MP#2 using
Flowgorithm
Save as MP2.fprg
Do MP#3 using
Flowgorithm
Save as MP3.fprg
Exercises
• Create a flowchart that:
1. Reads the length and the width of the rectangle.
Compute and display the Area and Perimeter of
the rectangle. Save as MP4.fprg
Save as MP7.fprg
Flowgorithm Data Types
Flowgorithm Operator Precedence
Flowgorithm Operators
Built-in Functions
Built-in Constants
Exercises: Your turn..
5. Create a flowchart that inputs the base and the
height of the right triangle. Calculate and display the
angle that makes it with the horizontal.
x
Seatwork #1
Given the circuit shown below, develop a flowchart that
allows the user to input values for resistor (R1),
inductor (L1), frequency (f) and the voltage source (VS).
Thereafter, compute and display the voltage drop
across the resistor (VR) and the inductor (VL).
XL = 2fL1
Z = R12 + XL2
VL = VS (XL / Z)
VR = VS (R / Z)
Seatwork #2
• The area of an ellipse is given by the formula: Area =
ab. The circumference of an ellipse is given by the
formula C = 4 (a+b)2
•
The relationship for the total resistance is:
Note: You need to convert the interest rate to monthly rate, and
the term into months. Test check: 120,000 for the loan amount,
30 years for the term, and annual interest rate of 7%.
Branching Statement
• Used to cause certain actions within a program if a
certain condition is met.
• Symbol:
• Examples:
X = Random(100) => returns 0 to 99
Bingo = Random(76) => returns 0 to 75
Machine Problem #10
10. You were hired by PAGCOR as part of a programming
team in-charge of automating its BINGO game. Your
task is to draw a flowchart that will randomize a number
from 1 to 75. Your algorithm should determine and
display the letter corresponding to that number.
Numbers from 1 to 15, display ‘B’, 16 to 30 ‘I’, 31 to
45 ‘N’, 46 to 60 ‘G’ and 61 to 75, display ‘O’.
Answer to Seatwork #10
Exercise: Your Turn…
• Draw a flowchart that inputs the user’s age. Display
the name of his/her favorite snack according to the ff.
age group:
Seatwork
Looping
• Used for operations that are repeated for some
number of times.
• Loop repeats until some specified condition at the
beginning or end of the loop is met.
• Looping blocks:
– For block
– While block For While Do
– Do block
For Block Structure
ctr
1 10
Example:
ctr = 1 to 10
While Block Structure
ctr <=10
Example:
ctr <= 10
Do Block Structure
ctr <=10
Example:
ctr <= 10
Repetition Problem #1
• Make a flowchart that displays numbers from 1 to 10
using FOR block.
Repetition Problem #2
• Make a flowchart that displays numbers from 1 to 10
using WHILE block.
Repetition Problem #3
• Make a flowchart that displays numbers from 1 to 10
using DO block.
Repetition Problem #4
• Draw a flowchart that will
compute and display the sum
of numbers from 1 to 10.
Repetition Problem #5
• Draw a flowchart that will
compute and display the
average of 5 exam scores
entered by the user.
Repetition Problem #6
• Modify problem #4 to allow the
user to input the total number of
exam scores. Draw the flowchart
to compute and display the
average exam score.
Repetition Problem #7
• Draw a flowchart that will input 5
exam scores from the user and
determine whether the score is
passing (a score of 75 or above)
or failing. Your flowchart should
count the number of passing and
failing scores. Display the
average of the score, the number
of failing scores, and the number
of passing scores.
x
z
x
z
Repetition Problem #8
• Draw a flowchart that computes the squares and
cubes of the integers from 1 to 10 with the following
output.
Number Square Cube
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
6 36 216
7 49 343
8 64 512
9 81 729
10 100 1000
Answer
Your Turn #1:
• Draw a flowchart that prints the degrees Celsius from
5 to 45 (step 5) with their equivalent degrees
Fahrenheit as follows: Use the Formula:
9
$ ' + 32
5
Your Turn #2:
• The bank charges 12% simple interest on the amount
per annum. Draw a flowchart that allows the user to
input for the amount loan and the number of years to
pay. Compute and display the lump sum amount for
each year.
Formula: Amt = P (1 + r t)
where: Amt – lump sum amount
P – Amount loan
r – interest rate (12%)
t – # of years
Your Turn #3:
• A bank offers a car loan at the rate of 15% compounded
monthly. Draw a flowchart allowing the user to input for
the loan amount of the car and the period of years to pay.
Compute and display the monthly payments to amortize
the loan and determine the total amount at the end of the
period.
compounded interest
Formula: i
12
n = years x (12 months)
PA
1 i 1
n
i 1 i
n
Your Turn #4:
• Draw a flowchart that prints the angles in degrees
from 0 to 80 (step 10) and its equivalent Sine() and
Tan() in radians as follows:
Your Turn #5:
• Make a flowchart that computes and displays the
distance a body falls in feet per second, for the first 5
seconds of free fall as given by the equation:
S = ½ at2 where: S = the distance in feet
a = acceleration due to gravity (32 ft/sec2)
t = time in seconds
• Output:
x
z
Cont.
Assignment #1
• Draw a flowchart for each item that produces table of
x and y values for the ff:
1. y 3x , − 2x + x for x between 5 to 10 step 0.5
-. -/
2. y 1 + x + + for x between 1 to 5 step 0.25
0
3. y πx for x between 5 to 25
Assignment #2
• Draw a flowchart that display the sum of the
following:
1. ∑44
-5 i = 1 + 2 + 3 +… + 99 + 100
2. ∑<4
-5 i divisible by 2 = 2 + 4 + … + 48 + 50
3. ∑4
-5 i
= 1 + 2 + … + 9 + 10
End of Module 1