Disclaimer: College of Information and Communications Technology
Disclaimer: College of Information and Communications Technology
Disclaimer
This learning material is used in compliance with the flexible teaching-learning approach
espoused by CHED in response to the pandemic that has globally affected educational institutions.
Authors and publishers of the contents are well acknowledged. As such, the college and its faculty
do not claim ownership of all sourced information. This learning material will solely be used for
instructional purposes not for commercialization.
Chapter 2
Program
Design
Tools
Chapter 2: Program Design Tools
Module Overview
Program Design tools are the tools used to develop a program. A program is the
expression of an algorithm in a programming language.
This module will provide the different program design tools. It will cover the following
lessons:
Lesson 1: Algorithm
Lesson 2: Pseudocode
Lesson 3: Flowchart
Learning Outcomes
Module Map
Draw flowchart
and write
pseudocode to Design, implement, test, an
design a ebug a program, based on
complete iven specification, that use
each of the following
fundamental programming
omponents: (1) primitive da
ypes, (2} basic computatio
Program 3) simple I/0, (4) conditiona
Interpret different Design Tools and iterative structures, (5
flowchart symbols definition of functions and
parameter passing, and (6 CC102
recursion
Explain how a
program solution Analyze and simulate resul
using the differen of algorithms that may be
rogram design too mplemented as a solution t
s transformed into a given problem.
program code
Flowchart - described as the blueprint of program during the Program Development Process.
Introduction
In your daily life, you may face problems through various activities. A problem means an
objective or an output that we must achieve, for example preparing a meal is considered a
problem, and we must follow consecutive steps sequentially to attain the required objective and
get the meal
Chapter 2: Program Design Tools
LESSON 1: Algorithm
Step 1: Start
Step 2: Input H and W (H = height, W=width)
Step 3. Compute the Area by multiplying H and W
Step 4: Print Area
Step 5: End
Example 2: Write an algorithm that calculates the sum of two numbers entered by
the user and display the result.
Step 1: Start
Step 2: Enter the number num1 and num2
Step 3. Perform the sum of the two numbers using the equation
sum = num1 + num2, the output is the sum
Step 4: Print sum
Step 5: End
Example 3. Write an algorithm to compute and display the average and product of
three (3) numbers.
Step 1: Start
Step 2: Read the values of num1, num2 and num3
Step 3. Perform the average and product of the three numbers
using the equations:
Average = (num1 + num2 + num3) / 3
Product = num1 * num2 * num3
Step 4: Print Average, Product
Step 5: End
3. ITS InfoTechSkills. (2020, April 26). Flowchart and Algorithm Sample Problems
Tagalog | Beginners Guide 2020.
YouTube. https://www.youtube.com/watch?v=BQP2doXjVlQ
Chapter 2: Program Design Tools
NAME:
PROGRAM / YR / BLK:
COURSE CODE / TITLE: AEC9 – Business Logic
TIME / DAY:
CHAPTER
2
1. Write a sequence of steps that will solve for the payable amount of Samsung 6
Edge; the price is: P38,390.00; plus 3% interest rate. The customer is given a two
mode of payments, in six [6] or twelve [12] month terms.
Ans: 1.
Chapter 2: Program Design Tools
LESSON 2: Pseudocode
Improves the readability of any approach. It’s one of the best approaches to start
implementation of an algorithm.
Acts as a bridge between the program and the algorithm or flowchart. Also works
as a rough documentation, so the program of one developer can be understood
easily when a pseudocode is written out.
The main goal of a pseudocode is to explain what exactly each line of a program
should do, hence making the code construction phase easier for the
programmer.
The program design process describes the algorithm for the solution of the problem.
Algorithm specify what actions and operations a program will take. A programmer has
several program design tools to choose from, flowcharts, decision, tables or
pseudocodes – in formulating an algorithm.
Example of an Algorithm:
Get the employee name, hourly rate, hours worked, deductions
Calculate gross pay and net pay
Write name, gross pay and net pay.
Example 2: Write a pseudocode that calculates the sum of two numbers entered by
the user and display the result.
Example 3. Write a pseudocode to compute and display the average and product of
three (3) numbers.
3. Codeacademy. (2019, May 9). What is Pseudocode And How Do You Use It?
YouTube. https://www.youtube.com/watch?v=PwGA4Lm8zuE
Chapter 2: Program Design Tools
NAME:
PROGRAM / YR / BLK:
COURSE CODE / TITLE: AEC9 – Business Logic
TIME / DAY:
CHAPTER
2
3. Write a sequence of steps that will compute and display the sum and product of two
numbers.
Chapter 2: Program Design Tools
4. Write an algorithm / pseudocode that will input values for A & B. Compare two
values inputted and print which of the values is higher including the mark “Higher”.
Chapter 2: Program Design Tools
LESSON 3: Flowchart
Flowcharts are drawn using standard symbols that connotes specific meanings.
These are the 8 standard symbols used in constructing a flowchart:
• Effective analysis: With the help of flowchart, problem can be analyzed in more
effective way.
• Efficient coding: The flowcharts act as a guide during the system’s analysis and
program development phase.
• Complex logic: Sometimes, the program logic is quite complicated. In this case,
flowchart becomes complex and clumsy.
• Alterations and modifications: If alterations are required the flowchart may require re-
drawing completely.
• The essentials of what is done can easily be lost in the technical details of how it is
done
f. A flow chart on one page should not break and jump to another page
g. A flow chart should have no more than around 15 symbols (not including START and
STOP).
3.7.1 Sequence
Draw a flowchart for a program that calculates the sum of two numbers
entered by the user and display the result.
Solution:
Input: The first number is num1 and the second number is num2
Solution
sum = num1 + num2 where the result is sum.
:
Chapter 2: Program Design Tools
1 Start START
End
5 End
1. The flowchart should start with the Start symbol and end with End symbol.
2. num1, num2 and sum are variable names. A variable is a storage of data or a
memory storage that holds a value.
3. The equation: sum = num1 + num2 indicates the sum of the value of num1, to
the value of num2, and stores the result in sum.
4. Entering the values in num1 and num2 is done by using the term “Enter”
inside the parallelogram or input symbol. The term “Read” or “Input” can also
be used.
5. The sum of the equation is written inside the rectangle or process symbol as it
represents an arithmetic equation.
6. The output is expressed with a parallelogram or output symbol using the term
“Print”. The term “Output” can also be used.
7. Lines with arrows or flowlines are from top to bottom and show the order of
the algorithm.
Chapter 2: Program Design Tools
Draw a flowchart for a program that will compute and display the
average and product of three (3) numbers.
Solution:
1 Start START
Print
average,
4 Print the average and the product product
5 End End
Chapter 2: Program Design Tools
3.7.1.1 Selection
Problem No. 3:
Draw a flowchart for a program that will input two numbers, num1 and
num2. Compare the two inputted values and print which of the values is higher
including the remark “higher”.
Solution:
Define the Problem
1 Start START
If num1 is greater
than num2, num1 is
Print Print
higher. However, if
4 num1 is less than
num2, “higher” num1, “higher”
num2, num2 is
higher
Print the number and
5 the remark “higher”
6 End
Chapter 2: Program Design Tools
End
Problem No. 4:
Solution:
1 Start START
Calculate the
3 average grade Grade =
(m1+m2+m3+m4)/4
Grade <
75
If Grade is less than
4 75, print “Failed” else
print “Passed” Print Print
“Passed “ “Failed”
5 End
End
Chapter 2: Program Design Tools
3.7.1.2 Loop
Basics of Looping
Numbers: 1 2 3 4
5
Sum of the numbers: 1+2+3+4+5
The sum is: 15
The variable that holds the temporary value for the sum is
called the accumulator. The accumulator can also be used for
multiplications and other mathematical applications.
Problem No. 5:
Solution:
START
1 Start
8 Stop
Problem No. 6:
Draw a flowchart to compute the area of the circle starting with
radius 1 up to 5, then print each radius and the corresponding area of the
circle.
Solution:
Output: Print the radius and each area where the radius is from
1 to 5.
Chapter 2: Program Design Tools
START
1 Start
Print
4 Print radius and area radius,area
Types of Loop
a. Infinite Loop – A loop that runs without an end it is due to wrong logical
operation or expression used, or wrong variables used to control the
Chapter 2: Program Design Tools
termination of the loop. Others call this logical error. Often this type of error
is the hardest type of error to debug. This kind of loop should be avoided.
Chapter 2: Program Design Tools
Problem No. 7:
START
1 Start
Test if number is
greater than the num >
value of the counter. N ctr? Y
If the number is
greater than the
counter, stop
4 processing. Print End
However, if the ctr
number is less than
the counter, loop
back and repeat
steps 3 to 4.
5 Stop A
b. Index Loop. A loop that executes when the number of iterations is explicit
in the problem. The printing of numbers 1 to 10 is an example of this type
of loop.
Problem No. 8:
Solution:
1 Start START
2 Initialize counter to 0
ctr=0
Problem No. 9:
Draw a flowchart that asks for a number and print the integers of
the inputted number.
Solution:
1 Start START
START
1 Start
ctr=0
Initialize the counter num=0
2 to 0 and num to 0
Input
Enter the desired
3 num
number
Print
ctr
Print the value of the
5 counter
Stop
Chapter 2: Program Design Tools
NAME:
Chapter 2: Program Design Tools
PROGRAM / YR / BLK:
COURSE CODE / TITLE: AEC9 – Business Logic
TIME / DAY:
CHAPTER
2
I. Problem Analysis. Identify the input, process and output of the following problem
statements.
1. Read two (2) records in a computer. The first record will contain unit price and the
second number will contain quantity. Draw a flowchart that will compute and
display the amount by multiplying unit price and quantity.
Input Processing Output
Flowchart:
Chapter 2: Program Design Tools
2. Draw a flowchart that will compute and display the area of a rectangle using the
formula: Area = Length * Width
Input Processing Output
Flowchart:
Synthesis
Algorithms and flowcharts are two different tools used for creating new programs,
especially in computer programming. An algorithm is a step-by-step analysis of the process, while
a flowchart explains the steps of a program in a graphical way.
Chapter 2: Program Design Tools
NAME:
PROGRAM / YR / BLK:
COURSE CODE / TITLE: AEC9 – Business Logic
TIME / DAY:
CHAPTER
2
Assignment
For each of the following problem statements, write the algorithm, draw the
flowchart and write the pseudocode:
A. Problems (Sequence)
1. Draw a flowchart that will accept the length of the base and height of a triangle and print
the area. Use the formula: Area = (base * height) / 2
2. Draw a flowchart that accepts dollar value and print the equivalent peso value. The
flowchart will convert dollar to peso having an exchange rate of 1 is to 53.25.
3. Draw a flowchart that will convert Fahrenheit to Celsius using the formula:
Celsius = (5/9) * (Fahrenheit – 32) where Fahrenheit is 20.
4. Draw a flowchart that reads in three numbers num1, num2, num3 and determine which is
the largest.
5. Draw a flowchart that read unit price and quantity. Compute and display the amount by
multiplying unit price and quantity.
B.
Chapter 2: Program Design Tools
C. Problems (Selection)
1. Display “IT’S COLD!” if the temperature is less than 20, “IT’S HOT!” is the temperature is
greater than 30, “COOL CLIMATE” otherwise.
2. Output “Congratulations you PASSED!” if the student’s grade is greater than or equal to
75. Otherwise, output “Sorry, you failed”
3. Accept two integers for variables int1 and int2 respectively and print the integers in
lowest to highest.
4. Identify whether the inputted number is a positive or negative. Consider 0 as positive.
5. Identify whether the inputted number is even or odd.
6. Accept three (3) numbers and determine the highest number, if there are equal numbers
print the equal numbers otherwise do not print anything.
7. Accept three (3) integers and determine if they are equal numbers. If there are equal
numbers, print the product of the equal numbers, otherwise print the average of the
numbers.
8. CounterVille Company plans to give a year-end bonus to each of its employee. It will
compute the bonus of an employee. Consider the following conditions: If the employee’s
monthly salary is less than 2,000 pesos, the bonus is 50% of the salary; for employees
with salaries greater than 2,000 pesos, the bonus is 1,500 pesos. Print the name and the
corresponding bonus for each employee.
9. Accept the evaluation score of a faculty and determine its equivalent remarks. Print the
name of the faculty and the remarks obtained. Remarks are based on the following
criteria:
4.50 – 5.00 - Outstanding
4.00 – 4.49 - Very Satisfactory
3.50 – 3.99 - Satisfactory
3.00 – 3.99 - Needs Improvement
2.99 below - Poor
D. Problems (Looping)
33
Catanduanes State University College of Information and Communications Technology