COMPUTER PROGRAMMING
COMPUTER PROGRAMMING – the process of designing or building something in a
logical way.
Examples:
Automation
Application/Software (Computer/Mobile)
Operating System
Games
PROGRAMMING LANGUAGE – a formal language that will be used to direct
instructions to the computer.
PROGRAMMING ALGORITHM
An algorithm is a step-by-step procedure or set of rules designed to solve a specific
problem or perform a particular task. It is a precise and unambiguous sequence of
instructions that can be executed by a computer or a person to achieve a desired
outcome.
Programming Algorithm – set of instructions/rules to be followed by a computer
program. It contains INPUT, PROCESS and OUTPUT. Depending on the problem to be
solved.
IPO Model
INPUT PROCESS OUTPUT
INPUT DESIGN TO COMPUTER PROCESS
THE COMPUTER DESIGN SEND TO CUT DESIGN
CUTTER
PRESS CALL ICON PHONE CONNECTS TO PHONE CONNECTS
NETWORK W/ YOUR FRIEND
VARIABLES
VARIABLE (In Math) – a letter that can represent any number. (x,y,z)
VARIABLE (in programming) – a letter or a word that’s serves as temporary storage
that can represent any value.
PROGRAMMING PROBLEM:
Create a program that will display the sum of two numbers inputted by
the user.
ALGORITHM: (Use the IPO Model)
Declare 3 variables 2 for the addends and 1 for the sum.
Let the user input the addends.
Perform the addition between the two addends and assign it to the sum.
Display the sum.
PSEUDOCODE
PSEUDOCODE – is a method that allows a programmer to represent the algorithm in
a more programming related way.
- Also called false codes because it tends to look like a programming
language but can still be understood by a person that has little
understanding in programming.
DO’s and DON’T’s
Do’s:
Proper Naming Convention
Simple and Concise
Don’ts
Don’t make it abstract.
Don’t make it Generalized.
PROGRAMMING PROBLEM:
Create a program that will display the sum of two numbers inputted by
the user.
Let numOne=0, numTwo=0 and Sum=0
Input numOne and numTwo
Sum= numOne + numTwo
Output sum
PROGRAMMING PROBLEM:
Create a program that displays the average of 2 numbers inputted by the
user.
Pseudocode 1:
Let numOne = 0, numTwo = 0 and ave = 0
Input numOne and numTwo
sum = numOne + NumTwo
Ave =sum/2
Output ave
Pseudocode 2:
Let numOne = 0, numTwo = 0 and ave = 0
Input numOne and numTwo
ave = (numOne + numTwo)/2
Output ave
PROGRAMMING PROBLEM:
Create a program that will display “Even” or “Odd” depending on the
number inputted by the user.
Pseudocode:
Let num = 0
Input num
IF num is an even number
output “Even.”
IF num is an odd number
output “odd.”
FLOWCHART
Flowchart – is a method that allows a programmer to represent the
Algorithm in a Diagram or an Illustration.
- Represents the sequence of a programming algorithm by
using standard graphic symbols that will represent the
Input, Process and Output.
BASIC SYMBOLS
These symbols are the ones often used to create a diagram that represents an
algorithm that a computer program must follow:
START OR INPUT &
END PREPARATION PROCESS OUTPUT Decision
Ellipse Hexagon Rectangle Parallelogram Diamond
PROGRAMMING PROBLEM:
Create a program that will display the sum of two numbers inputted by
the user.
Let numOne=0, numTwo=0 and Sum=0
Input numOne and numTwo
Sum= numOne + numTwo
Output sum
Flowchart
START
numOne = 0,
numTwo = 0,
sum =0
INPUT
numOne
numTwo
Sum = numOne +
numTwo
OUTPUT
sum
END