You are on page 1of 8

UNIVERSITY of MINDANAO

College of Engineering Education

Programming Logic and Design

Laboratory Exercise # 1

Algorithm, Pseudocode,and Flowchart

Espanio, Divine G.
Student Name
(LN, FN MI)

Laboratory Rm No. Subject Code

Subject Teacher

Date Submitted

Score

Laboratory Exercise # 1

ALGORITHM DEVELOPMENT AND FLOWCHARTING


Objectives:
At the end of this laboratory, you are expected to understand the importance of algorithm,
pseudocode,and flowchart in computer programming. Also, you are expected to design your
algorithm, pseudocode,and flowchart based on the given situation and criteria.
Materials
Laboratory manual

Introduction
The algorithmis a step by step method of solving a problem. It is commonly used for data
processing, calculation,and other related computer and mathematical operations.An
algorithm is also used to manipulate data in various ways, such as inserting a new data item,
searching for a particular item or sorting an item.
Example: the algorithm in finding the perimeter and area of a rectangle is
1. Get the length of the rectangle.
2. Get the width of the rectangle.
3. Find the perimeter using the following equation:
Perimeter=2*(length + width)
4. Find the area using the following equation:
Area = length * width
5. Display results.

Pseudocode is an informal program description that does not contain code syntax or
underlying technology considerations. It summarizes the program flow but excludes
underlying programming details.
Example:
Begin
input length, width
perimeter = 2 * (length + width)
area = length * width
print perimeter
print area
end

A flowchartis a graphical representation of an algorithm. It is usually drawn using certain


special-purpose symbols connected by arrows called flow lines.Table 1.1 shows the basic
flowchart symbols with its equivalent meaning
lowchart symbol Meaning

Terminal

Input/output operation

Process

Or Pre-defined process

On Off Page connector


page

Decision

Flow lines

Table 1.1 flowchart

Table 1.2 (sum of two numbers) shows an example of pseudocode with an


equivalentflowchart. Itillustrates that the program needs values for variablesxand y. Then, the
program will compute for the total and contain the result through the variable sum. After solving for
the sum, the result will be displayed to the screen.

Pseudocode Flowchart
Begin
input x and y
sum = x+y
print sum
End

Table 1.2 sum of two numbers flowchart and pseudocode

Diamond shape or decision symbol in the flowchart is usually used in representing decision making
or selection process in the program. Shown in table 1.3 is an example of a multiple selection
processes where the program will locate were the particular input belongs.

Pseudocode Flowchart

Begin
Input select
If select = 1
Print ̏Balance Inquiry”
goto a
If select = 2
Print ̏Withdrawal”
goto b
If select = 3
Print ̏Exit”
goto c
End

Table 1.3Multiple selection example


Table 1.4 showcase the example of an iterative flowchart. Iterative flowchart usually utilized in
program loops where the program will keep on repeating the same code or line of codes until the
certain condition is satisfied.

Pseudocode Flowchart

Begin
i=0
Sum = 0
While i<10
input x
Sum = sum +x
++i
Avg = sum / 10
Print avg
End

Laboratory 1.1

Given below is pseudocode on how to compute the overtime pay of the employee.
Begin
input hours, rateperhour
if hours >25
pay = hours * (rate*1.45)
print pay
if hours >10 but <25
pay = hours * (rate*1.25)
print pay
if hours <10
pay = hours *rate
print pay
end
1. Draw the equivalent flowchart of the given pseudocode

START
input hours,
rateperhour

pay = hours * print pay


Hours >25 (rate*1.45)

hours >10 pay = hours * print pay


but <25 (rate*1.25)

pay = hours print pay


hours <10 *rate

end

2. How many decision boxes needed in implementing the flowchart based on the given
pseudocode?
**************3 decision boxes
3. List all symbols used in creating the flowchart of given pseudocode.
*************** Terminal, Input/output operation, Process, Decision,

Flow lines.

Flow lines
Laboratory 1.2

Design andpseudocode and flowchart that will accept the evaluation score of a faculty and
determine its equivalent remarks. 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.49 - Needs Improvement
2.99 below - Poor

Algorithm:
The algorithm to determine the equivalent remarks of a faculty’s evaluation score is:
1. Get the name of the faculty.
2. Get the evaluation score of the faculty.
3. Test the score if it is greater than or equal to 4.50.
4. If the score is greater than or equal to 4.50, remarks is “Outstanding”. However, if the score
is less than 4.50, proceed to step 5.
5. Test the score if it is greater than or equal to 4.00.
6. If the score is greater than or equal to 4.00, remarks is “Very Satisfactory”. However, if the
score is less than 4.00, proceed to step 7.
7. Test the score if it is greater than or equal to 3.50.
8. If the score is greater than or equal to 3.50, remarks is “Satisfactory”. However, if the score is
less than 3.50, proceed to step 9.
9. Test the score if it is greater than or equal to 3.00.
10. If the score is greater than or equal to 3.00, remarks is “Needs Improvement”. However, if
the score is less than 3.00, remarks is” Poor”.
11. Display the faculty name, evaluation score,and remarks.

Pseudocode

Start
Input the name of the faculty
Input the evaluation score of the faculty
If score<45

If score<45

If score<45

If score<45

If score<45
End
Flowchart

You might also like