Week 2 - COMPUTER PROGRAMMING OVERVIEW
Week 2 - COMPUTER PROGRAMMING OVERVIEW
Week 2
COMPUTER PROGRAMMING OVERVIEW
This module will gather up the basics you need to start learning to program. Basic
components of a computer, both hardware and software and a brief overview of
programming languages and the program development life cycle will also introduce. This
module will also show the basic flowcharting symbols used in presenting the logic of a
program.
Learning Outcomes:
At the end of the module, the student should be able to:
1. Identify the different components of a computer;
2. Know about programming languages and their categories;
3. Understand the program development life cycle and apply it in problem-solving;
4. Analyze and apply the algorithm in flowchart
A. Hardware
1. Central Processing Unit (CPU)
The processor is generally known as the "brain" of the computer.
2. Memory
Random Access Memory (RAM) or the Primary Memory is
hardware components that temporarily hold programs and data, that the
CPU is actively working on it. This is also known as a volatile memory,
New Era University
College of Computer Studies
Rm. 247-B, High School Annex B, New Era University
Tel. No.: (+632) 981-4221 loc 3825
E-mail: [email protected]
which means all data and information stored in the RAM will be deleted
once the computer system is shutdown.
Secondary memory is a non-volatile memory, usually a hard disk
or a solid-state drive wherein data and information are permanently
stored.
3. Input and Output devices
Input and output devices allow a computer system to interact with the
outside world by moving data into and out of the system.
B. Software
1. System Programs
Programs that are needed to keep all the hardware and software
systems running together smoothly.
2. Application Programs
A Program that we used to get our works done.
3. Compiler
It translates the high-level instructions or code of a human into
machine language or a machine code required by the CPU.
Example code:
C++ Java
C Language
Python
2. Assembly Language
Similar to machine language, and it uses more convenient numbers,
symbols, and abbreviations to describe the huge strings of 1's and 0's to
make it both easier and more memorable to type in instructions.
Example code:
2. Runtime Error
Compilers aren't perfect and so can't catch all errors at compile
time. This is especially true for logic errors, such as infinite loops.
Flowcharting Symbols
A flowchart is a graphical representation of a process or system that details the
sequencing of steps required to create output.
SEMANTIC
SYMBOLS
Terminal(Start/End)
Initialization
Input/output(display)
Process
Decision
On page Connector
Off-page connector
Predefined Process
Sample 2: Identify if qualified to vote or too young using on-page Connector Symbol.
It uses to connect within the same page, the A (a user define) from “accept age” is called
entry to A connector, then exit from A connector into "Decision Symbol."
Algorithm Flowchart
1. Start
2. Initialize zero to age
3. Display “Enter age”
4. Accept age
5. IF age is greater or
equal to eighteen,
Display “Qualified to
vote”
ELSE
Display “ Too Young”
6. End
New Era University
College of Computer Studies
Rm. 247-B, High School Annex B, New Era University
Tel. No.: (+632) 981-4221 loc 3825
E-mail: [email protected]
Sample 3: Identify the given number if positive, negative, or origin using off-page
connector (on a separate page).
Algorithm
1. Start 5.2. Display “Number is Negative”
2. Initialize zero to num 5.2.1. Go to step 5.1.1
3. Print “Enter num” 5.3. Diplay “Number is Origin”
4. Accept the value of num 5.3.1. Go to step 5.1.1
5. If num is greater than zero, 6. End
5.1 . Display “Number is Positive”
5.1.1. Display “the number is”
the value of num
5.1.1.1. Go to step 6
Flowchart
New Era University
College of Computer Studies
Rm. 247-B, High School Annex B, New Era University
Tel. No.: (+632) 981-4221 loc 3825
E-mail: [email protected]
New Era University
College of Computer Studies
Rm. 247-B, High School Annex B, New Era University
Tel. No.: (+632) 981-4221 loc 3825
E-mail: [email protected]
Sample 4: Find the sum of the sequence number. (let’s assume that the value of
b will become 5)
Algorithm
1. Start
2. Initialize one to a, sum, and b is equal to zero.
3. Print “Enter Number”
4. Accept number then store to b
5. IF a is less than or equal to the value of b, go to step 6
ELSE
Go to step 9
6. add the value of sum plus the value of a then store to sum,
7. add 1 to a.
8. go to step 5
9. Print the value of sum
10. End
Flowchart
Simulation
Accumulator/counter Output:
a b sum Enter Number: 5 this value will be
T1 0 0
(Just an initial value)
the value of b not
5 zero anymore
T2 (base on the input 1
value)
The value of sum add the sequence
T3 3
T4 6 is 15 1+2+3+4+5=15
T5 10
F6 15
New Era University
College of Computer Studies
Rm. 247-B, High School Annex B, New Era University
Tel. No.: (+632) 981-4221 loc 3825
E-mail: [email protected]
References:
Cay S. Horstmann (2019), Brief Java: Early Objects, Enhanced eText Edition 9, Wiley
Global Education US, ISBN: 9781119499138
http://www.btechsmartclass.com/c_programming/C-Program-Development-Life-
Cycle.html
http://cssimplified.com/computer-organisation-and-assembly-language-
programming/beginner-write-your-first-assembly-language-program-hello-world-
explained