0% found this document useful (0 votes)
5 views

Lab1 Introduction To Algorithm Part1!1!20232024

Uploaded by

Ameer Hakim
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Lab1 Introduction To Algorithm Part1!1!20232024

Uploaded by

Ameer Hakim
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Faculty of Engineering Technology Page No.

1 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 10/09/2018

FACULTY OF ENGINEERING TECHNOLOGY


DEPARTMENT OF ELECTRICAL ENGINEERING
TECHNOLOGY

MAKMAL TEKNOLOGI PAPAN LITAR TERCETAK


MTPLT (Online)

WORKING INSTRUCTION AND REPORT


Course Code & Name /
BNR 20803 : COMPUTER PROGRAMMING
Kod & Nama Kursus
Code & Title of Experiment/
Lab 1: Introduction to Algorithm Part 1
Kod & Tajuk Ujikaji
Date of Experiment/
Tarikh Ujikaji
Programme/Program BNF
Group/ Kumpulan
Matrix No./
Name/Nama
No. Matrik
Group Members/ 1.MUHAMMAD AIDIL BIN SUHAIMI CN230086
Ahli Kumpulan 2.
3.
4.
Instructor Name / 1. ENCIK MOHD HAKIMI BIN ZOHARI
Nama Instruktor 2.
Result
/70 %
Keputusan
Discussion
/20%
Perbincangan
Conclusion
Assessment / Penilaian /10%
Kesimpulan

TOTAL / JUMLAH /100%


Faculty of Engineering Technology Page No. 2 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 01/10/2023

1. EXPERIMENT LEARNING OUTCOMES

At the end of the lab session, students should be able to:

1.1. Understand the basic symbols of flow charts and method of pseudocode
1.2. Identify the Pseudocode and flow charts.
1.3. Create the Pseudocode and flow charts.

2. INTRODUCTION / THEORY

2.1. Flowchart Symbols


Only a few symbols are needed to indicate the necessary operations in a flowchart. These
symbols have been standardized by the American National Standards Institute (ANSI). These
Symbols are shown below and their functions are discussed.

a. Terminal

The terminal symbol, as the name implies, is used to indicate the starting (BEGIN),
stopping
(END), and pause (HALT) in the program logic flow. It is the first symbol and the last
symbol in the program logic. In addition, if the program logic calls for a pause in the
program, that also is indicated with a terminal symbol. A pause is normally used in
the program logic under some error conditions or in case the forms had to be
changed in the computer’s line printer during the processing of that program.

b. Input/Output
Faculty of Engineering Technology Page No. 3 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 01/10/2023


The input/output symbol is used to denote any function of an input/output device in the
program. If there is a program instruction to input data from a disk, tape, card reader,
terminal, or any other type of input device, that step will be indicated in the flowchart with
an input/output symbol. Similarly, all output instructions, whether it is output on a printer,
magnetic tape, magnetic disk, terminal screen, or any output device, are indicated in the
flowchart with an input/output symbol.

c. Processing

A processing symbol is used in a flowchart to represent arithmetic and data movement


instructions. Thus, all arithmetic processes such as adding, subtracting, multiplying and
dividing are shown by a processing symbol. The logical process of moving data from one
location of the main memory to another is also denoted by this symbol. When more than
one arithmetic and data movement instructions are to be executed consecutively, they are
normally placed in the same processing box and they are assumed to be executed in the
order of their appearance.

d. Flow lines

Flowlines with arrowheads are used to indicate the flow of operation, that is, the exact
sequence in which the instructions are to be executed. The normal flow of flowchart is from
top to bottom and left to right. Arrowheads are required only when the normal top to
bottom flow is not to be followed. However, as a good practice and in order to avoid
confusion, flow lines are usually drawn with an arrowhead at the point of entry to a symbol.
Good practice also dictates that flow lines should not cross each other and that such
intersections should be avoided whenever possible.
Faculty of Engineering Technology Page No. 4 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 01/10/2023


e. Decision

The decision symbol is used in a flowchart to indicate a point at which a decision has to be
made and a branch to one of two or more alternative points is possible. Figure 1.2 shows
three different ways in which a decision symbol can be used. It may be noted from these
examples that the criterion for making the decision should be indicated clearly within the
decision box. Moreover, the condition upon which each of the possible exit paths will be
executed, should be identified and all the possible paths should be accounted for. During
execution, the appropriate path is followed depending upon the result of the decision.

f. Connector

If a flowchart becomes very long, the flow lines start crisscrossing at many places that
causes confusion and reduces the clarity of the flowchart. Moreover, there are instances
when a flowchart becomes too long to fit in a single page and the use of flow lines becomes
impossible. Thus, whenever a flowchart becomes too complex that the number and
direction of flow lines is confusing or it spreads over more than one page, it is useful to
utilize the connector symbol as a substitute for flow lines. This symbol represents an entry
from, or an exit to another part of the flowchart. A connector symbol is represented by a
circle and a letter or digit is placed within the circle to indicate the link. A pair of identically
labeled connector symbols is commonly used to indicate a continued flow when the use of a
line is confusing. So two connectors with identical labels serve the same function as a long
flow line. That is, they show an exit to some other chart section, or they indicate an entry
from another part of the chart. How is it possible to determine if a connector is used as an
entry or an exit point? It is very simple: if an arrow enters but does not leave a connector, it
Faculty of Engineering Technology Page No. 5 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 01/10/2023


is an exit point and program control is transferred to the identically labeled connector that
does have an outlet. It may be noted that connectors do not represent any operation and
their use in a flowchart is only for the sake of convenience and clarity.

2.2. Different ways of branching using decision (diamond) symbols

2.3. Pseudocode
Pseudocode is a language very close to English that allows us to represent a program concisely.
The only thing you need is a statement to show where you are starting and where you are
ending a program. We will be using the word Start for the start point and the word End to show
the finish point. Each program will contain statements to accomplish our goal; this will satisfy
step 3 from Chapter 1. Rules for Pseudocode are:
a. Write only one statement per line
b. Capitalize initial keyword
c. Indent to show hierarchy
d. End multiline structures
e. Keep statements language independent
Faculty of Engineering Technology Page No. 6 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 01/10/2023

3. EQUIPMENT / REQUIREMENT

3.1. A computer with Microsoft Office and C/C++ program

4 PROCEDURES (TASKS)

4.1 By Using handwriting;

4.1.1 Please create the pseudocode for a program that can adding (total) and averaging (AVG) two
number (X and Y) which are received from input. Then, the total and average are displayed.
(5 marks)
4.1.2Please convert the pseudocode in task 4.1.1 into the flowchart.

(10 marks)
Faculty of Engineering Technology Page No. 7 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 01/10/2023

4.2 By Using handwriting;

4.2.1 Please create the pseudocode for a program that are able to measure or sense the car speed in
miles per hour (mph), and then, convert the speed in miles into kilometers per hour (km/h). The
program also display the speed in kmh. If the driver exceed the speed limit of 70kmh, program will
warn the driver through dislay with the message ‘PLEASE REDUCE SPEED’.
(5 marks)
4.2.2 Please convert the pseudocode in task 4.2.1 into the flowchart.
(10 marks)
Faculty of Engineering Technology Page No. 8 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 01/10/2023


4.3 By Using handwriting;

4.3.1 Please create the pseudocode for a program that can adding and averaging five numbers (A,B,C,D
and E) which are received from input. Then, display the total (TOTAL) and average (AVE).
(5 marks)
4.3.2 Please convert the pseudocode in task 4.3.1 into the flowchart.
(10 marks)
Faculty of Engineering Technology Page No. 9 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 01/10/2023

4.4 From the flowchart given, please convert into the pseudocode.

4.4.1 Insert and total for 2 numbers and display the total. (5 marks)
4.4.2 Insert, total and average for 4 input numbers and selection the set average to display the result.
(10 marks)
Faculty of Engineering Technology Page No. 10 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 01/10/2023

4.4.3 Turn ON/OFF AC from set temperature (10 marks)


Faculty of Engineering Technology Page No. 11 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 01/10/2023

5. DISCUSSION

5.1 Pseudocode and Advantages/Disadvantages Of Pseudocode?


-Better communication -Time consuming
-Effective analysis -Difficult to show branching and looping
-Efficient coding -It is visualization program

(10 marks)

5.2 Flowchart and Advantages/Disadvantages Of Flowchart?


-Easily modified
-Implement structured concepts
-Done easily on notepad

-Not visual
-No accepted standard
-Varies from company to company

(10 marks)
Faculty of Engineering Technology Page No. 12 / 12

Department of Electrical Engineering Technology Revision No. 1

Title: Lab 1: Introduction to Algorithm Part 1 Effective Date 01/10/2023

6. CONCLUSION

Algorithms are the rule and sequences made to understand thing and flowchart is the
Diagrammatic representation of the same. A flowchart visualizes an algorithm for a
Non-technical view while a pseudocode outlines the algorithm’s key principles in a
Linear presentation
(5 marks)

Prepared by / Disediakan oleh : Approved by / Disahkan oleh :

Signature / Tandatangan : Signature / Tandatangan :


Name / Nama : Dr. Mohd Shamian Bin Zainal Name / Nama : Ts. Dr. Lam Hong Yin
Date / Tarikh : 1st October 2023 Date / Tarikh : 1st October 2023

You might also like