0% found this document useful (0 votes)
107 views10 pages

Course: Experiment No.: Name: Section: Date Performed: Date Submitted: Instructor

1. The document describes Laboratory Activity No. 1 on algorithm design and representation for a BS Mechanical Engineering course. 2. It discusses the key steps in problem solving including problem definition and analysis, design using algorithms and flowcharts, implementation by coding, and testing. 3. Basic flowchart symbols are shown and two sample problems are provided to illustrate creating algorithms in narrative and pseudocode form, designing flowcharts, and determining inputs, processes, and outputs.

Uploaded by

SK Pinagsama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views10 pages

Course: Experiment No.: Name: Section: Date Performed: Date Submitted: Instructor

1. The document describes Laboratory Activity No. 1 on algorithm design and representation for a BS Mechanical Engineering course. 2. It discusses the key steps in problem solving including problem definition and analysis, design using algorithms and flowcharts, implementation by coding, and testing. 3. Basic flowchart symbols are shown and two sample problems are provided to illustrate creating algorithms in narrative and pseudocode form, designing flowcharts, and determining inputs, processes, and outputs.

Uploaded by

SK Pinagsama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Course: BS Mechanical Engineering Experiment No.

: 1
Name: Jomarie G. Laggui Section: ES21S1
Date Performed: September 6, 2021
Date Submitted: September 6, 2021
Instructor: Engr. Mon Arjay Malbog

LABORATORY ACTIVITY NO.1

ALGORITHM DESIGN AND REPRESENTATION

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.

2. Intended Learning Outcomes (ILOs):

The students shall be able to:

1. Familiarize on different analytical tools in software development


2. Understand and apply the use of algorithm and flowcharting in solving mathematical problems

3. Discussion:

In program development, there are steps/procedures that have to follow. Figure 1. shows the program development life
cycle.

Problem Definition and


Analysis

Design

Implementation

Testing

Figure 1. Program Development Life Cycle


Problem Definition and Analysis

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

Table 1. IPO Chart

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.

Basic Flowchart Symbols

Terminal Processing box Input/output box Initialization Box

Decision On-page Off - page connector Arrow


heads

Figure 2.Basic Flowchart Symbol


Implementation

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++

5. Procedure and Output

EXERCISE No. 1 (Simple Problem)

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.

1. What is required in the problem given?


To display the amount of new monthly pay

2. What is/are input item/s?

Current monthly pay (25,000), raise next month (4%)


3. What is/are the processing item/s?

New monthly pay = current monthly pay x raise next month

4. What is/are the output/s of the problem?

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

Let new monthly pay=0


Let x=25000
Let y=0.04

New monthly pay = x*y

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.

1. What is required in the problem given?


Display the average of four quizzes, and if pass or fail.

2. What is/are input item/s?

Four Quizzes (Q1, Q2, Q3, Q4)

3. What is/are the processing item/s?

Average= (Q1, Q2, Q3, Q4)/4, Average >= 75

4. What is/are the output/s of the problem?

Average, Pass or Fail


ALGORITHM
NARRATIVE PSEUDOCODE
1. Start 1. Start
2. Let Average = 0. 2. Let Average equal to zero.
3. Let Q1 be quiz one and an initial value of zero.
initial value of 0. 3. Let Q1 be quiz one and an
4. Let Q2 be quiz two and an initial value of zero.
initial value of 0. 4. Let Q2 be quiz two and an
5. Let Q3 be quiz three and an initial value of zero.
initial value of 0. 5. Let Q3 be quiz three and an
6. Let Q4 be quiz four and an initial value of zero.
initial value of 0. 6. Let Q4 be quiz four and an
7. Average = (Q1+Q2+Q3+Q4)/4 initial value of zero.
8. If Average >= 75 7. Average is the the sum of Q1 plus
8.1 Print " Passed" 8. If Average is greater than or equal
else Q2 plus Q3 plus Q4 divided by four
8.2 Print "Failed" to seventy-five
9. End 8.1 Print " Passed"
else
8.2 Print "Failed"
9. End

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.

1. What is required in the problem given?


Display sum of 10 input numbers and flowchart.

2. What is/are input item/s?

10 numbers (a,b,c,d,e,f,g,h,i,j)

3. What is/are the processing item/s?

Sum = a+b+c+d+e+f+g+h+i+j

4. What is/are the output/s of the problem?

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

Let Sum = 0 Input e


Let a = 0
Let b = 0
Let c = 0
Let d = 0
Let e = 0
Input f
Let f = 0
Let g = 0
Let h = 0
Let i = 0 Input g
Let j = 0

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.

You might also like