DYBITITP113:: Introduction To Programming
DYBITITP113:: Introduction To Programming
DYBITITP113:: Introduction To Programming
Introduction to Programming
HERLIZA F. ESTRADA
Instructor, College of Computer Studies
Declaration:
This learning module is an exclusive property of Dr. Yanga’s Colleges, Inc., as an essential part of the
REIMAGINED Learning Program for the Academic Year 2020-2021, and shall only be used by and for
DYCIans. No part of this learning module shall be reproduced, distributed, transmitted, and/or sold, without
the consent of DYCI.
Week No. 4
PROGRAM DESIGN - SELECTION FLOWCHART
This module will help you achieve greater grasps in the understanding of pictorial or
diagrammatic representation of an algorithm using selection and repetition structure.
Selection Structure
Binary Selection
In binary selection, if the condition is met then one path is taken, otherwise the second
possible path is followed. In each of the examples below, the first case described
requires a process to be completed only if the condition is true. The process is ignored if
the condition is false. In the second case, there is an alternative process if the condition
is false.
Multi-way selection
Multi-way selection allows for any number of possible choices, or cases. The path taken
is determined by the evaluation of the expression. Multi-way selection is often referred
to as a case structure.
1
Problem:
Design the flowchart and pseudocode that determine if the number given by
the user is an odd or an even number.
Pseudocode Flowchart
Step 5: STOP
F
num % 2 == 0?
PRINT num is
Even number
PRINT num is
Odd number
STOP
2
Example 1: Design a pseudocode and a flowchart that will determine whether to
age can vote or not.
STOP
Solution:
Pseudocode Flowchart
Step 1: START
Step 2: DECLARE and START
INITIALIZE num1 = 0,
num2 = 0
Step 3: INPUT num1, num2 num1 = 0,
num2 = 0
Step 3: IF num1 > num2
PRINT num1 is the
largest
INPUT
ELSE
num1, num2
PRINT num2 is the
largest
Step 4: STOP
num1 > num2
F PRINT
num2 is the largest
T
PRINT num1
is the largest
A
A
STOP
4
Example 3: Design the flowchart and pseudocode that determine if the number
given by the user is positive or negative number.
Solution:
Pseudocode Flowchart
Step 1: START
Step 2: DECLARE and INITIALIZE START
num to 0
Step 3: INPUT num
num = 0
Step 4: IF num >= 0 THEN
DISPLAY num is Positive
number
ELSE INPUT num
F T
num is num is
Negative Positive
number number
STOP
5
Example 3: Design the pseudocode and flowchart that allows the user to enter a
value for age and determine whether the given age is for minor adult or children.
If the age is less than or equal to 12, Display “age is still a child”. If the age is
greater than or equal to 13 but not greater than 18, Display “age is a minor”. If
the age is greater than or equal to 18, Display “age is an adult”. If the age value is
less than zer0, Display “invalid entry”.
Solution:
Pseudocode Pseudocode
age>= T age is an
18 adult
F STOP
6
Name: Rating:
Year and Section: Professor / Instructor:
Due of Submission:
Week No. 4
PROGRAM DESIGN - FLOWCHART
Instructions: Write the Pseudocode and draw the flowchart of the following problem:
1. ABC corporation plans to give a yearly bonus to each of its employees. Compute
the bonus of an employee. Consider the following criteria: Salary < 6000, bonus is
50% of salary; Salary > = 6000but less than 10000, bonus is 40%; Salary 10000
and up bonus is 35%. Print the corresponding salary and bonus
Pseudocode Flowchart
7
Name: Rating:
Year and Section: Professor / Instructor:
Due of Submission:
Week No. 4
PROGRAM DESIGN - FLOWCHART
2. If the wholesale cost of an item is under P500, the markup is 20%. If the wholesale
cost is at least P500, the markup is 30%. Determine the retail price for an item whose
wholesale cost is given by the user.
Pseudocode Flowchart
8
Name: Rating:
Year and Section: Professor / Instructor:
Due of Submission:
Week No. 4
PROGRAM DESIGN - FLOWCHART
3. The ABS Credit Cooperative approves a loan application. If the applicant’s income
is t least P30000 or the value of his/her assets is at least P150000; in addition, his/her
total liabilities must be less than P75000. Create a flowchart and pseudocode that
accepts three numbers representing income, assets and liabilities. Display a message
whether the application is approved or not.
Pseudocode Flowchart
9
Name: Rating:
Year and Section: Professor / Instructor:
Due of Submission:
Week No. 4
PROGRAM DESIGN - FLOWCHART
Pseudocode Flowchart
10
Name: Rating:
Year and Section: Professor / Instructor:
Due of Submission:
Week No. 4
PROGRAM DESIGN - FLOWCHART
Algorithm Flowchart
11
Codesansar. (2020, June 24). Computer Basics. Retrieved from
https://www.codesansar.com/computer-basics/.
Farell, J. (2015). Programming Logic and Design 8th edition. Stanford: Cengage
Learning.
freecodecamp.org. (2017, October 12). A Gentler Introduction to Programming. Retrieved
from https://www.freecodecamp.org/news/a-gentler-introduction-to-programming-
1f57383a1b2c/.
geeksforgeeks.org. (2020, June 15). Difference between Algorithm, Pseudocode and
Program. Retrieved from https://www.geeksforgeeks.org/difference-between-
algorithm-pseudocode-and- program/#:~:text=An%20algorithm%20is%20defined
%20as,used%20to%20repres ent%20an%20algorithm.
geeksforgeeks.org. (2020, June 15). Java Programming Language. Retrieved from
https://www.geeksforgeeks.org/java/.
Goel, A. (2020, April 28). What is Programming. Retrieved from
https://hackr.io/blog/what-is-programming.
P2PU. (2020, June 24). Planning and designing software solutions. Retrieved
from https://courses.p2pu.org/en/courses/2544/hsc-sdd-planning-and-
designing- software-solutions/.
tutorialspoint.com. (2020, June 03). Computer Programming - Overview. Retrieved from
https://www.tutorialspoint.com/computer_programming/computer_programming_o
verview.htm.
tutorialspoint.com. (2020, June 15). Programming Methodologies. Retrieved from
https://www.tutorialspoint.com/programming_methodologies/index.htm.
12