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

Module 1 Programing

The document outlines the fundamentals of programming, including key elements such as syntax, variables, functions, and operators. It also discusses algorithm design, characteristics, advantages, and disadvantages, emphasizing the importance of clear and unambiguous steps. Additionally, it introduces pseudocode as a method for representing algorithms in a programming-like manner.

Uploaded by

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

Module 1 Programing

The document outlines the fundamentals of programming, including key elements such as syntax, variables, functions, and operators. It also discusses algorithm design, characteristics, advantages, and disadvantages, emphasizing the importance of clear and unambiguous steps. Additionally, it introduces pseudocode as a method for representing algorithms in a programming-like manner.

Uploaded by

Hacchi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

PROGRAM LOGIC FORMULATION

PROGRAMMING
- is the process of creating a set of instructions that tell a computer
how to perform a task. Can be done using variety of computer
programming languages such as C++, JavaScript, Python, and many
more.
PROGRAM LOGIC FORMULATION
Elements of Programming
❑ Syntax - Refers to the rules that
define the structure of a
language, the rules that control
the structure of the symbols,
punctuation and words of
programming languages.
Elements of Programming
❑ Variable - Is a symbolic name for (or reference
to) information. The variable’s name
represents what information the variable
contains. They are called variables because the
represented information can change but the
operations on the variable remain the same.
Example: X, Y, Z or ID_NO, EMP_NAME
Elements of Programming
❑ Function - Is simply a
“chunk” of code that you
can use over and over
again, rather than writing
it out multiple times.
Example
Elements of Programming
❑ Arithmetic Operators – Arithmetic
Operators allows you to code a
programs that add, subtract, multiply
and divide.
❑ Logical Operators – To test whether
conditions
Elements of Programming
❑ Loop – Allows us to execute a statement or group of statements
multiple times and following is the general from of a loop statement
in most of the programming languages. Also an instruction that
repeats until a specified condition is reached.
Programming Design Tools
❑ Algorithm - Is a set of instructions or rules to be followed by a
computer program, which should contain an INPUT, PROCESS and an
OUTPUT depending on the problem to be solve. An algorithm is
merely the sequence of steps taken to solve a problem.
Example 1: An algorithm to add two numbers:
Take two number inputs
Add numbers using the + operator
Display the result
IPO Model

INPUT PROCESS OUTPUT

Example 2 Send design to laser


cutter.
Computer works out
vectors.
Laser cuts out design

Example 3 Press call on mobile


phone
Phone connects to
network.
Phone connects with
your friend.
Example 4: The instructions for changing a flat tire are straightforward and go something
like the following:
1. Raise the car.
2. Remove the lug nuts that affix the faulty tire to the car.
3. Remove the tire.
4. Mount the new tire.
5. Install the lug nuts.
6. Lower the car.
Characteristics of Algorithms
❖ Clear and Unambiguous: Algorithm should be clear and unambiguous. Each of
its steps should be clear in all aspects and must lead to only one meaning.
❖ Well-Defined Inputs: If an algorithm says to take inputs, it should be
well-defined inputs.
❖ Well-Defined Outputs: The algorithm must clearly define what output will be
yielded and it should be well-defined as well.
❖ Finite-ness: The algorithm must be finite, i.e. it should not end up in an infinite
loops or similar.
Characteristics of Algorithms
❖ Feasible: The algorithm must be simple, generic and practical, such that it can
be executed upon will the available resources. It must not contain some future
technology, or anything.
❖ Language Independent: The Algorithm designed must be
language-independent, i.e. it must be just plain instructions that can be
implemented in any language, and yet the output will be same, as expected.
Advantages of Algorithms
It is easy to understand.
Algorithm is a step-wise representation of a solution to a given problem.
In Algorithm the problem is broken down into smaller pieces or steps hence, it
is easier for the programmer to convert it into an actual program.
Disadvantages of Algorithms
Writing an algorithm takes a long time so it is time-consuming.
Branching and Looping statements are difficult to show in Algorithms
How to design an Algorithm
1. The problem that is to be solved by this algorithm.
2. The constraints of the problem that must be considered while solving the
problem.
3. The solution to this problem, in the given constraints.
4. The input to be taken to solve the problem.
5. The output to be expected when the problem is solved.
Qualities of a good Algorithms.
1. Input and output should be defined precisely.
2. Each step in the algorithm should be clear and unambiguous.
3. Algorithms should be most effective among many different ways to solve a
problem.
4. An algorithm shouldn't include computer code. Instead, the algorithm should
be written in such a way that it can be used in different programming
languages.
Pseudocode
- A method that allows a programmer to represent the algorithm in
a more programming way.
- Are also called false codes because it tends to look like a
programming language but can still be understood by a person that has
little understand in programming.
❑ Activity #2.
1. Create an algorithm in withdrawing Php 5, 000 in the ATM
Machine.
2. Create an algorithm in logging in your Facebook account.
REFERENCES
Textbooks:
✔ Zak, Diane, Introduction to Programming with C++, C & E Publishing c2011
✔ Bronson, Gary J., C++ for Engineers and Scientists, Course Tech c2010
✔ Lambert, Kenneth, Fundamentals of C++ and data structures, 2009, Cengage
✔ Bronson, Gary J, C++ for engineers and scientists, 2010, Course Technology
✔ Deitel, PJ, C : how to program, 2009, Pearson Education, G,
REFERENCES
Website:
✔ Fungsi Motherboard Processor Memori Dan Harddisk | Computer hardware, Computer hardware store,
Computer Pinterest. https://www.pinterest.ph/pin/88594317657692933/?mt=login
✔ Unit 4 - Hardware & Ergo - Davids BTA30 Portfolio 2016 Sites.google.com.
https://sites.google.com/site/davidsbtaportfolio/unit-4---hardware-ergo.
✔ Computer Software Icon #229946 - Free Icons Library. Icon-library.com.
https://icon-library.com/icon/computer-software-icon-14.html
✔ https://www.programiz.com/cpp-programming
✔ https://www.rapidtables.com/code/text/ascii-table.html
--- END ---

You might also like