Sie sind auf Seite 1von 15

UNIVERSITY of MINDANAO

College of Engineering Education

Programming Logic and Design

Laboratory Exercise # 1

Algorithm, Pseudocode, and Flowchart

Guerrero, Harold Hope C.


Student Name
(LN, FN MI)
BE 216 Subject Code
2937
Laboratory Rm No.

Subject Teacher Engr. Marianne G. Wata


September 14, 2019
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 algorithm is 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.
Sample Algorithm:
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 flowchart is 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.

Flowchart Symbol Meaning

Terminal

Input/output operation

Process

Initialization
Pre-defined process

Off-page connector

On page connector

Decision

Flow lines

Table 1.1 Figures used in Flowcharting

Operator Description
== equal to
!= not equal to
< less than
<= less than or equal to
> greater than
>= greater than or equal to
Table 1.2 Relational Operators
Operator Description
! not
&& and
|| or
Table 1.3 Logical Operators

Figure 1.1 (Sum of two numbers) shows an example of pseudocode with an


equivalent flowchart. It illustrates that the program needs values for variables x
and 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
initialize x and y
input x and y
sum = x+y
print sum
End

Figure 1.1 Sum of two numbers (pseudocode and flowchart).


Diamond shape or decision symbol in the flowchart is usually used in
representing decision making or selection process in the program. Shown in
Figure 1.2(multiple Selection) is an example of 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

Figure 1.2 Pseudocode and Flowchart of a conditional statement


Figure 1.3 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

Figure 1.3 Pseudocode and Flowchart of an Iterative Statement


Laboratory Task 1.1
Given below is the 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
Questions
1. Draw the equivalent flowchart of the given pseudocode.

Start

Input the number


of hours and the
rate per hour

Pay=hours*(rate*1.45) Print pay


Hours>25

Hours>10 Pay=hours*(rate*1.25) Print pay


Hours<25

Pay=hours*rate Print pay


Hours<10

End
2. How many decision boxes needed in implementing the flowchart based on
the given pseudocode?
Answer:
It had 3 decision boxes needed in implementing the flowchart.

_____________________________________________________________
_____________________________________________________________
_____________________________________________________________

3. List all symbols used in creating the flowchart of given pseudocode.


Answer:
The symbol used in creating the flowchart is: Terminal, Input/output
Operation, Process, Initialization, Decision, Flow Lines.

_____________________________________________________________
_____________________________________________________________
_____________________________________________________________

Laboratory Task 1.2

Design a pseudocode 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

Begin
Input name of faculty, evaluation score of faculty.

If score >= 4.50,


remark is “Outstanding”

If score >= 4.00,


remark is “Very Satisfactory”

If score >= 3.50,


remark is “Satisfactory”

If score >= 3.00,


remark is “Needs Improvement”

If score < 3.00,


remark is “Poor”

Display faculty name, score, remarks


End.
Flowchart
Input name of faculty,
evaluation score of Start
faculty

Score>=4.5
0 Remark is “Outstanding”

Score>=4.0
Remark is “Very Satisfactory”
0 Display Faculty name,
Score, Remark

Score>=3.5 Remark is “Satisfactory”


0
END

Score>=3.0 Remark is “Needs Improvement”


0
Score< Remark is “Poor”
3.00
Student Name: Harold Hope C. Guerrero Subject Code: 2937

Subject Teacher: Engr. Marianne G. Wata Date Submitted:


Sept. 14, 2019
Laboratory Exercise No: 1 Score:

Laboratory Exercise Rubric for Programming Logic and Design

Ratings
Parameters
3 2 1

Specifications Contains the complete Lacks one-three details Lacks more than three
(30%) details to the given to the given task. details to the given
task. (20) task.
(30) (10)

The flowchart The flowchart illustrates The flowchart does not


Flowchart (30%) illustrates the correct the correct solution for illustrate the correct
solution for the given the given task with solution for the given
task and the symbols minor errors found. task and the symbols
are correctly used. Some of the symbols are are poorly used.
incorrectly used.
(30) (20) (10)

Pseudo code The pseudocode or The pseudocode The pseudocode


Algorithm algorithm is clearly algorithm is somehow algorithm is not clear
depicted and is easy to clear and is not that and is not easy to
(20%) follow. easy to follow. follow.
(20) (14) (7)

The documentation is The documentation The documentation


Documentation well written and clearly lacks some information, didn’t satisfy all the
(20%) explained all the and some mistakes are questions that were
questions given in the found in the questions. given in the laboratory
laboratory exercise. exercise.
(20) (14) (7)

________________________
Signature of Subject Teacher

Das könnte Ihnen auch gefallen