ComProg Module - M6 Final
ComProg Module - M6 Final
NET
(Q3M1) ALGORITHMS, FLOWCHARTS, DATA TYPES, AND
PSEUDOCODES
DURATION : 3-4 WEEKS
INSTRUCTOR :
EMAIL :
NOTE: Write your answers on the answer sheet provided (Check the last page). DO NOT write anything on the module.
LESSON OBJECTIVES
Classify programming languages and identify its usage, and enumerate the process in program development.
Understand algorithm, use pseudocode and flowchart un problem solving; and
Identify data types and variables.
LESSON DISCUSSION
Problem solving is a part of our everyday life. In computer programming, problem solving is inevitable too and it is actually one of the main reasons why a program is created. In this
lesson, we will learn the various concepts on how to plan a program’s output, step by step, using algorithm applied to pseudocode and flowchart. Identifying variables and the corresponding
data types will also be discussed in this lesson.
WHAT IS AN ALGORITHM?
Generally, an algorithm is a step-by-step procedure to solve problems. A guide for installing new software, a manual for assembling appliances, and even recipes are examples of an
algorithm. In programming, making an algorithm is exciting – they are expressed in a programming language or in a pseudocode.
Algorithm makes the whole procedure more efficient as well as consistent. It also helps in identifying decision points, processes, and essential variables to solve the problem. A
programmer can also see and determine easily the errors in a particular process using an algorithm.
On the other hand, structured design approach focuses on dividing programs, concentrates on each subprogram's task, and then later on combined them as a whole. This approach is
commonly used in big and complex object-oriented programs. This approach also works well if you are working on a team because a person or a group of people can be assigned on a specific
module or subprogram.
Boolean - can only contain two values, true or false. Yes or no or on and off is also possible. Byte - data type to be used if you want to store binary data (set of 0s and 1s). It is an
unsigned type that cannot contain negative values.
Char - used to hold a single character, specifically a single unicode character. Unicode is a 16-bit character which represents all the letters and symbols of all major languages existing.
Date - data type that holds date values, time values, or the combination of both.
Decimal - holds decimal values up to 29 significant digits. It is specifically designed for financial calculations.
Double - powerful data type that can hold even the smallest and the largest approximation of a real number.
Integer - holds only whole number, but loads fast compare to other data types. Long - data type used to hold larger integer numbers.
Object - holds objects’ addresses.
Short - used to contain lesser value of whole number compared to data type Integer Programmers use this data type to optimize program runtime as well as to save memory.
Single - like double data type, it is also used to contain floating point values. The difference is that it is used for much lesser values.
String - data type used to hold set or multiple of characters, like words or sentences.
Sample Problem:
A teacher would like to create a program that will classify if a student's grade must be marked Passed or Failed. Any grades lower than 60 is considered failed. From this given Information,
please provide the necessary pseudocode, flowchart, and data type.
I. Pseudocode
If student's grade is greater than or equal to 60
You are already familiar with this pseudocode. It has been used as an example in the previous Print “Passed”
discussion from this pseudocode, we must create a flowchart. Remember that a flowchart is just a else
graphical representation of a pseudocode. Print “Failed”
II. Start
Flowchart
The next step is to identify the variable's data type. Let us first analyze the variable, which is the student's
grade. As we know, it can also contain decimal numbers and is usually in the scale of 0-100. The double
data type is the best data type for this variable since a student's grade is usually a real number (numbers
with decimal places).
Create a pseudocode and flowchart for a program that will classify whether the age inputted into the program is more than 60 or not. Age 60 or more should be able to get a discount of 20%
from stores. Your program shall print a message “Discount can be availed” if age is more than 60, however, when age is less than 60, your program should classify whether the person has a
disability or not. If there is a disability, then same discount can be availed, otherwise, your program shall show a message “No discount can be availed”.
1. It is used to contain lesser value of whole number compared to data type Integer. Programmers make use of this data type to optimize program runtime as well as to save memory.
ANSWER SHEET
Activity 1
PSEUDOCODE:
FLOWCHART:
1. ______________________________________________
2. ______________________________________________
3. ______________________________________________
POST-TEST IDENTIFICATION
4. ______________________________________________
5. ______________________________________________
6. ______________________________________________
7. ______________________________________________
8. ______________________________________________