Laboratory Activity 1 - PLAD
Laboratory Activity 1 - PLAD
: 1
Name: Pascua, Prince Jethro A. Section: CPE 223
Date Performed: 09/12/2022
Date Submitted: 09/12/2022
Instructor: Cherry D. Casuat
1. Objective(s):
The activity aims to introduce the significance of algorithm and flowchart in creating a
program using C++ programming language base on the requirement.
Problem Definition
and Analysis
Design
Implementation
Testing
The first step in solving a problem is to define and analyze the problem. The
purpose of defining and analyzing a problem is to determine the goal of solving a problem
and the items that are needed to achieve that goal. Programmers refer to the goal as the
output, and they refer to the items needed to achieve the goal as the input. In defining and
analyzing a problem, always search first for the output, and then for the input. Some
programmers use an input, process and output (IPO) chart to organize and summarize the
results of problem definition and analysis. Table 1 shows how to make use of IPO. The details
discussion of the chart is in the second step of problem-solving process.
Input Processing Output
1. Processing items:
2. Algorithm:
a. Narrative form:
b. Pseudocode
Design
Algorithm
The second step in the problem-solving process is to plan a design using analytical
tools such as algorithm and flowchart. Algorithm has two different forms, a narrative
form or short English statements and statements closer to the instructions in the program
which is called pseudocode. These two forms of algorithm have the same output which is
the steps/procedures in developing the program of the given problem. Record the algorithm
in the processing column of the IPO chart. Most algorithms begin with an instruction that
enters the input items into the computer. The Input items are the items listed in the
Input column of the IPO chart. A processing item represents an intermediate value that the
algorithm uses when processing the input into the output. Most algorithms end an
instruction to display, print, or store the output items listed in the Output column of the IPO
chart.
A programmer reviews an algorithm by desk-checking, or hand-tracing, it in
other words, by completing each step in the algorithm manually. You desk-check an
algorithm to verify that it is not missing any steps, and that the existing steps are correct
and in the proper order. Before you begin the desk-check, first choose a set of sample
data for the input value, which you then use to manually compute the expected output
values. If every step has no errors, a programmer now can construct a flowchart.
Flowchart
Only after the programmer is satisfied that the flowchart is correct does he or
she then move on to the fourth step in the problem-solving process which is
implementation. Implementation is a step where the programming is converting the
designs into codes. A code is a language that the computer can understand.
After completing the codes, the programmer then desk-checks the program to
make sure that the algorithm and flowchart were translated correctly, then final process in
the problem-solving process can be done.
Testing
The final step in the problem-solving process is to test if the codes have no
errors using the component of a programming language such as compiler or assembler
that detects errors. This is usually done by entering, into the computer, the C++
instructions listed in your algorithm. Other instructions required by the C++ compiler
have to be entered as well. After entering the appropriate instructions, you then run
(execute) the program. (More details will be discussed in Activity no. 2.)
4. Resources:
DevC++
Sarah Cruz has been working for COMPUTER Z Company for four years. Last year, Sarah
received a 5% raise, which brought her current monthly pay to 25,000.00 pesos. Sarah is
scheduled to receive a 4% raise next month. She wants to write a program that will display, on
the computer screen, the amount of her new monthly pay.
It is required to write a program that will display on the computer screen the amount of her new
monthly pay.
The input item is the current monthly pay (25,000.00 pesos) and 4% raise next month.
3. What is/are the processing item/s?
The processing items are the monthly pay (25,000) multiplied by her new rate percent next
month (4%) added by current monthly pay.
25,000*4%= 1000+current monthly pay, the new amount salary of Sarah Cruz is 26,000 pesos.
ALGORITHM
NARRATIVE PSEUDOCODE
1. Let Pay= 0
2. Let Rate= 4% Let pay equal to zero;
3. Let monthly pay= 25,000 Let rate equal to four percent;
4. Input Rate Let monthly pay equal to twenty-five thousand;
5. Input Pay Input the new rate;
6. Compute for Pay; Input Pay;
Pay= C*R+C Compute for new pay by multiplying the current
month pay to the new rate;
7. Print Pay Current pay added by the product in the
computation Will be her new monthly pay for
next month;
Print Pay;
FLOWCHART
EXERCISE No. 2 (Problem Involving Condition)
A student took four quizzes in a term and would like to compute their average. He also
would like
to know if the average has a passing mark. Note that grade lower than 75% is failed.
Average=quiz1+quiz2+quiz3+qui
z4 / 4
The failing grade of the student is < 75%, therefore the grade of the student should be greater than
75%.
ALGORITHM
NARRATIVE PSEUDOCODE
1. Let average=0 1.
If student average is greater than or equal to 75%
2. Input quiz 1 (q1) Print “passed”
3. Input quiz 2 (q2) else
4. Input quiz 3 (q3) Print “failed”
5. Input quiz 4 (q4) 2.
6. Get the scores of 4 quizzes in a Let average to zero;
term (q1, q2, q3, q4) Get the sum of four quizzes;
7. Compute for the average; Input the sum of the four quizzes;
average=(q1+q2+q3+q4)/4 Compute the sum of four quizzes divided by number
8. If average < 75% = failed of times the student took the quizzes;
9. If average >= 75% = passed Print the average;
10. Print Average
FLOWCHART
EXERCISE No. 3 (Problem Involving Iteration)
Jonathan was given an assignment in his programming course that requires creating
an algorithm and flowchart of ten input numbers then displaying its sum.
Requires creating an algorithm and flowchart of ten input numbers then displaying its sum.
Sum=num1+num2+num3+num4+num5+ num6+num7+num8+num9+num10
ALGORITHM
NARRATIVE PSEUDOCODE
1. Let Sum=0
2. Input 1st number (num1) Let sum equal to zero;
3. Input 2nd number (num2) Set Input number one to num1, set number two to num2,
4. Input 3rd number (num3) set number three to num3, set number four to num4,
5. Input 4th number (num4) number five to num5, set number six to num6, set
6. Input 5th number (num5) number seven to num7, set number eight to num8, set
th
7. Input 6 number (num6) number nine to num9, set number ten to num10;
8. Input 7th number (num7) Compute for the sum of the ten input numbers by
9. Input 8th number (num8) simply adding them;
th
10. Input 9 number (num9) Print sum;
11. Input10th number (num10)
12. Compute for the sum of num1 to num10;
Sum= num1+num2+num3+num4+num5+
num6+num7+num8+num9+num10
13. Print Sum
FLOWCHART
6. Conclusion:
In conclusion I think that this kind of activity will help me to improve my logical skills
and understand on how to make algorithms and flowcharts of the given problem solving
questions.