0% found this document useful (0 votes)
33 views16 pages

Instructional Module: Republic of The Philippines Nueva Vizcaya State University Bambang, Nueva Vizcaya

This document is an instructional module for a Fundamentals of Programming course at Nueva Vizcaya State University. It covers programming languages, flowcharts, and the program development life cycle. Specifically, it discusses [1] the definition of programming languages and types of languages; [2] the components and steps of the program development life cycle; and [3] provides examples of how to construct algorithms and solve problems using flowcharts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views16 pages

Instructional Module: Republic of The Philippines Nueva Vizcaya State University Bambang, Nueva Vizcaya

This document is an instructional module for a Fundamentals of Programming course at Nueva Vizcaya State University. It covers programming languages, flowcharts, and the program development life cycle. Specifically, it discusses [1] the definition of programming languages and types of languages; [2] the components and steps of the program development life cycle; and [3] provides examples of how to construct algorithms and solve problems using flowcharts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Republic of the Philippines

NUEVA VIZCAYA STATE UNIVERSITY


Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

College: Industrial Technology


Campus: Bambang Campus

DEGREE Information COURSE


PROGRAM Technology NO.
SPECIALIZATION COURSE Fundamentals of Programming
TITLE
YEAR LEVEL 1st Year TIME FRAME 15 WK 1-3 IM 1
hrs NO. NO.

I. UNIT TITLE/CHAPTER TITLE


PROGRAMMING LANGUAGE AND FLOWCHART

II. LESSON TITLE


1. Programming Language
2. Types of Languages
3. Program Development Life Cycle
4. Input, Process, Output
5. Program Flowchart
5.1 What is a Flowchart?
5.2 Symbols used in flowchart
5.3 When to use a Flowchart?
5.4 Benefits of a Program Flowchart
5.5 Examples #1 and #2 : Using Input, Output and processing symbols
5.6 Example #3 and #4: Flowchart example using Conditions (if
statement)
5.7 Example #5 and #6: Flowchart using Conditions (nested if statements)
5.8 Example #7 and #8. Flowchart Example using loop

III. LESSON OVERVIEW

In this lesson you will learn what a flow chart is and why computer programmers use them
when developing new applications. You will also learn about common flow charts and see
examples of them.

IV. DESIRED LEARNING OUTCOMES

1. Construct algorithms using the proper symbols in program flowchart


2. Solve programming problems through applying the phases of program
development life cycle

V. LESSON CONTENT

1. Programming language is how we can talk to computers. It's a lot like English but it's
kind of quirky too. Unlike people, machines cannot guess our intent. We have to be
super meticulous and describe what we want in every little detail.

2. Types of Languages
There are three main kinds of programming language:

1
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

3. Program Development Life Cycle


The program development lifecycle is part of the software lifecycle, characterized by the
following steps:

Problem Definition

In this phase, we define the problem statement and we decide the boundaries of the problem. In

this phase we need to understand the problem statement, what is our requirement, what should

be the output of the problem solution. These are defined in this first phase of the program

development life cycle.

Problem Analysis

In phase 2, we determine the requirements like variables, functions, etc. to solve the problem.

That means we gather the required resources to solve the problem defined in the problem

definition phase. We also determine the bounds of the solution.

Algorithm Development

During this phase, we develop a step by step procedure to solve the problem using the

specification given in the previous phase. This phase is very important for program development.

That means we write the solution in step by step statements.

2
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

Coding & Documentation

This phase uses a programming language to write or implement the actual programming

instructions for the steps defined in the previous phase. In this phase, we construct the actual

program. That means we write the program to solve the given problem using programming

languages like C, C++, Java, etc.,

Testing & Debugging

During this phase, we check whether the code written in the previous step is solving the specified

problem or not. That means we test the program whether it is solving the problem for various input

data values or not. We also test whether it is providing the desired output or not.

Maintenance

During this phase, the program is actively used by the users. If any enhancements found in this

phase, all the phases are to be repeated to make the enhancements. That means in this phase,

the solution (program) is used by the end-user. If the user encounters any problem or wants any

enhancement, then we need to repeat all the phases from the starting, so that the encountered

problem is solved or enhancement is added.

4. Input, Process and Output (IPO)

Input is the user giving something to the program. This are the things needed to accomplish
something like for example when you take a bath. Inputs needed to take a bath are soap, bath
towel, shampoo, water and pail.
Another example, if you want to display the SUM of 2 integer numbers. The inputs there are the
2 integer numbers that are represented by a variable x and y or any letter representing the 2
integer number.
Output is the program giving something to the user. This are the result of a process. For
example, in getting the sum of 2 integer number. The output there is the SUM of the given
inputs x and y.
So, the mathematical expression for that expression is SUM = x + y.
Note: In programming always remember that the left side of expression in the output and the
right side is the input.
OUTPUT

SUM = X + Y

INPUT

3
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

Process is an execution of any specific program. It is considered an active entity that actions the
purpose of the application.
For example, If you are double click on your Google Chrome browser icon on your PC or laptop,
you start a process which will run the Google Chrome program. When you open another instance
of Chrome, you are essentially creating a two process.

In our previous example, the SUM of 2 integers, the process there is the adding of X and Y.

5. PROGRAM FLOWCHART

5.1 What Is a Flow Cart?


Flow charts are easy-to-understand diagrams that show how the steps of
a process fit together.

What is Algorithm?
Algorithm a process or set of rules to be followed in calculations or other
problem-solving operations, especially by a computer.

5.2 Symbols Used In Flowchart

Symbol Purpose Description

Indicates the flow of logic by


Flow line
connecting symbols.

Represents the start and the end of


Terminal(Stop/Start)
a flowchart.

Input/Output Used for input and output operation.

Used for arithmetic operations and


Processing
data-manipulations.

Used for decision making between


Decision
two or more alternatives.

On-page Connector Used to join different flowline

Used to connect the flowchart


Off-page Connector
portion on a different page.

Predefined Represents a group of statements


Process/Function performing one processing task.

4
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

Tip:

You can use many other symbols in a flow chart but remember that these diagrams are used
for communication . If you use symbols that only a few people understand, you may fail to get
your message across. So, be sure to keep things simple !

5.3 When to Use a Flow Chart

All manner of organizations use flow charts to:

 Define a process.
 Standardize a process.
 Communicate a process.
 Identify bottlenecks or waste in a process.
 Solve a problem .
 Improve a process.

5.4 Benefits of Program Flowchart

The advantages of program flowchart are as follows:


 Program flowchart can help programmers to find the bug in the process before
carrying out.
 It works as a blueprint when analyzing the systems and developing programs, which
makes coding more efficient.
 It improves programmers’ efficiency in maintaining the operating program.
 With the help of program flowchart, communicating the logic of a system to all
concerned gets much easier.

5.5 Examples #1 and #2 : Using Input/Output and processing symbols

EXAMPLE #1: Create a flowchart that shows the product of 3 integers. Use the
appropriate flowchart symbols.
Solution:
Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input. Let say variable A, B, C representing the 3 integers.
3. Determine your Process
Getting the product of A,B,C. Write the correct expression for the Process like
PRODUCT = A * B * C
4. Determine your Output
print PRODUCT
5. To END the flowchart, use terminal button again.
Algorithm:

1. read A,B,C
2. Find the value of PRODUCT using the formula PRODUCT = A*B*C
3. Print PRODUCT

5
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

Flowchart

START

input A,B,C

PRODUCT =A*B*C

print PRODUCT

END

Example #2: Calculate Pay using the formula pay = hours * rate.

Solution:

Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input. Base from the given formula the inputs are variable hours and
rate.
3. Determine your Process. Use the given formula.
pay = hours * rate
4. Determine your Output
print pay
5. To END the flowchart, use terminal button again.

Algorithm
1. read hours,rate
2. Find the value pay using the formula pay = hours * rate
3. Print pay

6
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

Flowchart

Note: In C# programming, if you use small letters or capital letters for your variable name, use it
as it is until the program is finish likewise when you are creating a flowchart. Thus, always check
your variable names used in your flowchart.

7
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

5.6 Example #3 and #4: Flowchart example with Conditions (if statement) using
DECISION Symbol

Example #3: Determine if the body temperature is above 32 degrees print “below
freezing” otherwise print “above freezing”.

Solution:

Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name temperature (because it is what the problem is referring to determine
if it is above 32 degrees.)
3. Determine your condition using DECISION Symbol.
temperature < 32 (we use greater than symbol (<) to determine what message will
be displayed based from the given problem)
4. Determine your Output.
If the condition is true then
print “above freezing”
If the condition is false then
Print “below freezing”
5. To END the flowchart, use terminal button again.
Algorithm:

1. read temperature
2. Is temperature < 32 (DECISION)
3. If YES print “above freezing”
If NO print “below freezing”

8
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

Example #4: Check if a person is eligible to vote or not.

Solution:

Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name is age
because it is what the problem is referring to determine if a person is eligible to
vote or not
3. Determine your condition base from the problem
age >= 18
4. Determine your Output
If the condition is true then
print “Eligible to Vote”

If the condition is false then


print “Not Eligible to Vote”

5. To END the flowchart, use terminal button again.


Algorithm
1. Enter age
2. Is age >= 18
3. If TRUE print “Eligible to Vote”
If FALSE print “Not Eligible to Vote”
Flowchart

9
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

5.7 Example #5 and #6: Flowchart using Conditions (nested if statements)

Example #5: Determine if a number is negative or positive.

Solution:

Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name is n
because it is what the problem is referring to determine if it is positive or
negative. Variable n is just a representation u can use any valid variable name.
3. Determine your condition base from the problem
Condition 1: n > 0 (this conditions is to determine positive numbers)
Condition 2: n< 0 (this condition is to determine negative numbers)

Tip: You have to think on your Cartesian plane considering your X and Y axis

4. Determine your Output


If the condition is true then
Print “n is positive”

If the condition is false then


print “n is negative”

5. To END the flowchart, use terminal button again.


Algorithm
1. Read n
2. Is n > 0
If True print”n is positive”
Is n< 0
If True print “n is negative”
If False print “n is a zero”
Flowchart

10
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

Example #6: Using Nested if statements, the following flowchart determine the following:

Condition Remarks
Score < 50 Fail
Score < 60 E
Score < 70 D
Score < 80 C
Score < 90 B
Otherwise A

Solution:

Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name is score
because it is what the problem is referring to determine the appropriate remarks
to display.

3. Determine your condition base from the problem


Condition 1: score < 50
Condition 2: score < 60
Condition 3: score < 70
Condition 4: score < 80
Condition 5: score < 90

4. Determine your Output


If the first condition is true then
Print “Fail”
If the second condition is true then
Print “E”
If the third condition is true then
Print “D”
If the fourth condition is true then
Print “C”
If the fifth condition is true then
Print “B”
otherwise
Print “A”

5. To END the flowchart, use terminal button again.


Algorithm
1. read score
2. Is score < 50
If YES print “Fail”
Is score < 60
If YES print “E”
Is score < 70
If YES print D
Is score < 80
If YES print C
Is score < 90
If Yes print B
Otherwise
print “A”
11
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

12
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

Flowchart

START

read score

Score <50 T print “Fail”

Score <60 T
print “E”

Score <70 T
print “D”

T
Score <80 print “C”

Score <90 T
print “B”

print “A”

END

13
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

5.8 Example #7 and #8. Flowchart Example using loop

Example #7: Print the series of numbers 2 , 4 , 6

Solution:

Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name is i
Tip: You can use any valid variable name to represent a number or given
3. Determine your condition base from the problem
Condition is: i <= 6
Let say the value of i is 2, since, i is less than 6 it will process the
expression
i + 1 then it will proceed to i = i +2. The algorithm will repeat the process
until the result of the condition is false, then that’s the time that the
process will terminate or stop.

4. Determine your Output


print 2,4,6
Question
Why it prints until 6 only? Because the limit of the condition is until 6 only
5. To END the flowchart, use terminal button again.

Algorithm

1. initialize i to 2
2. Is i < = 6
If TRUE print i + 1
i=i+2
repeat condition
If FALSE terminate
Flowchart

14
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

Example #8: Print the series of numbers 1,2,3,4,5


Solution:

Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name is n
Tip: You can use any valid variable name to represent a number or given
3. Determine your condition base from the problem
Condition is: n <= 5
Let say the value of n is 1, since, i is less than 5 it will proceed the
expression n = n + 1 then print the value of n. The algorithm will repeat
the process until the result of the condition is false, then that’s the time
the process will terminate or stop.

Note: n=n+1 means, if you substitute the value of n to 1 the expression


will become n = 1+1, then the answer will be assigned to variable n so the
new value of n will become 2. It will test again the condition, if it is true
then it will continue to process n = 2+1. The new value will be assigned to
variable n again which will become 3. It will repeat the process until the
value of n is 5. If the variable n is 5,then the condition turns to False
that’s the time it will stop.
Sample simulation:

n=1 New value of n


n=n+1
substitute the value
n to 1
n = 1+1 2
n = 2+1 3
n=3+1 4
N=4+1 5

4. Determine your Output


print 1,2,3,4,5
Question
Why it prints until 5 only? Because the limit of the condition is until 5.
5. To END the flowchart, use terminal button again.
Algorithm Flowchart

START
1. Initialize n to 1
2. Is n < = 5
3. If TRUE execute n = n +1 n=1
Print n
If FALSE terminate

F n<=5

T
END

n=n+1 15

print n
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE

16

You might also like