Course: Experiment No.: Name: Section: Date Performed: Date Submitted: Instructor
Course: Experiment No.: Name: Section: Date Performed: Date Submitted: Instructor
: 1
Name: Jomarie G. Laggui Section: ES21S1
Date Performed: September 6, 2021
Date Submitted: September 6, 2021
Instructor: Engr. Mon Arjay Malbog
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.
3. Discussion:
In program development, there are steps/procedures that have to follow. Figure 1. shows the program development life
cycle.
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.
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
Flowchart is a graphical representation of a program, derived from the algorithm. It uses standardized symbols to show
the steps that must be followed to accomplish the program’s goal.
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.
ALGORITHM
NARRATIVE PSEUDOCODE
1. Start 1. Start
2. Let New monthly pay = 0 2. Let New monthly pay equal to 0
3. Let x be the current monthly pay and an initial value of 3. Let x be the current monthly pay
25,000 an initial value of twenty-five thousand
4. Let y be the raise next month and an 4. Let y be the raise next month and an
initial value of 0.04 initial value of four percent
5. New monthly pay = x*y 5. New monthly pay equals x times y
6. Print New monthly pay 6. Print New monthly pay
7. End 7. End
FLOWCHART
Start
Print new
monthly pay
End
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.
FLOWCHART
Start
Let average = 0
Q1=0
Q2=0
Q3=0
Q4=0
Input Q1
Input Q2
Input Q3
Input Q4
Average =
(Q1+Q2+Q3+Q4)/4
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.
10 numbers (a,b,c,d,e,f,g,h,i,j)
Sum = a+b+c+d+e+f+g+h+i+j
Sum
ALGORITHM
NARRATIVE PSEUDOCODE
1. Start 1. Start
2. Let Sum equal to 0. 2. Let Sum equal to 0.
3. Let a be the first number 3. Let a be the first number
and an initial value of 0. and an initial value of 0.
4. Let b be the second number 4. Let b be the second number
and an initial value of 0. and an initial value of 0.
5. Let c be the third number 5. Let c be the third number
and an initial value of 0. and an initial value of 0.
6. Let d be the fourth number 6. Let d be the fourth number
and an initial value of 0. and an initial value of 0.
7. Let e be the fifth number 7. Let e be the fifth number
and an initial value of 0. and an initial value of 0.
8. Let f be the sixth number 8. Let f be the sixth number
and an initial value of 0. and an initial value of 0.
9. Let g be the seventh number 9. Let g be the seventh number
and an initial value of 0. and an initial value of 0.
10. Let h be the eight number 10. Let h be the eight number
and an initial value of 0. and an initial value of 0.
11. Let i be the ninth number 11. Let i be the ninth number
and an initial value of 0. and an initial value of 0.
12. Let j be the tenth number 12. Let j be the tenth number
and an initial value of 0. and an initial value of 0.
13. Sum = a+b+c+d+e+f+g+h+i+j 13. Sum is equal to a plus b plus c
14. Print Sum plus d plus e plus f plus g plus h plus i plus j
15. End 14. Print sum
15. End
FLOWCHART
Start A
Input h
Input a
Input i
Input b
Input j
Input c
Sum =
a+b+c+d+e+f+g+h+i+j
Input d
Print Sum
A
End
6. Conclusion:
This activity helps me to understand the importance of using algorithm and flowchart
in solving a mathematical problem. It helps me to clearly identify the input of a problem
in order to achieve its goal which is the output. The analytical tools help me to create a more organize and
understandable problem-solving process.