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

Week 2 - COMPUTER PROGRAMMING OVERVIEW

This document provides an overview of computer programming concepts for students. It discusses [1] the basic components of a computer including hardware and software, [2] an introduction to programming languages and the program development life cycle, and [3] flowcharting symbols used to represent program logic. The learning outcomes are to understand computer components, programming language categories, applying the program development process, and using flowcharts to analyze algorithms. Basic concepts covered include the CPU, memory, input/output devices, system and application software, compilers, high and low-level languages, and the problem solving steps of problem definition, analysis, coding, debugging, and flowcharting.

Uploaded by

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

Week 2 - COMPUTER PROGRAMMING OVERVIEW

This document provides an overview of computer programming concepts for students. It discusses [1] the basic components of a computer including hardware and software, [2] an introduction to programming languages and the program development life cycle, and [3] flowcharting symbols used to represent program logic. The learning outcomes are to understand computer components, programming language categories, applying the program development process, and using flowcharts to analyze algorithms. Basic concepts covered include the CPU, memory, input/output devices, system and application software, compilers, high and low-level languages, and the problem solving steps of problem definition, analysis, coding, debugging, and flowcharting.

Uploaded by

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

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]

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

Basic Components of Computer


A computer is a machine that stores data, information and performs a variety of
tasks such as interacts with peripheral devices and executes programs. Computer
Program is a process of writing statements or commands that instruct the computer how
to process data.
The physical computer and peripheral devices are collectively called the hardware.
The programs the computer executes are called the software.

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.

Overview of Computer Programming


Programming Language (PL) is a standardized communication technique for
expressing a sequence of instructions that the CPU can execute. PL consist of syntax as
a grammar of code.

Categories of Programming Language


1. High-level Programming Languages
A programming language that is more user-friendly and a language
used to English-like statements or code. A PL that translates into
machine code by the compiler.
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]

Example code:
C++ Java

C Language
Python

Examples above will display the String Hello Programming. It means


the keywords cout(in C++), printf(in C Language), System.out.print(in
Java), print (in Python) is to print or display.

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:

Sample Program of Displaying HELLO WORLD!!!


using Assembly Language by CSSimplified.com
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]

Program Development Life Cycle


Programming is not writing code right away. Instead, a good programmer follows
an organized methodology that breaks the process into a different task.
1. Problem definition
In this phase, it needs to define the problem statement and decide the
boundaries of the problem and need to understand the problem statement, what is
our requirement, what should be the output of the problem solution. These are
defined in this first phase of the program development life cycle.
2. Problem analysis
After the problem has been adequately defined, the simplest and yet the
most efficient and effective approach to solve the problem must be formulated.
Usually, this step involves breaking up the problem into smaller and simpler sub-
problems.
3. Algorithm Presentation
Once our problem is clearly defined, it can now set to finding a solution. In
computer programming, it is normally required to express our solution in a step-by-
step manner. The algorithm is a step by step process needed to solve a problem
through graphical representation called flowchart or pseudocode, which is a cross
between human language and programming language.
4. Coding and Debugging
After constructing the algorithm, it is now possible to create the source code.
The source code can now be written using the chosen programming language.
After writing a program, most of the time, programs are not working 100%
due to errors (bugs). The fixing program due to bugs is called the debugging
process.
Types of Errors
1. Compile Time-Errors
Occur if there is a syntax error in the code. The compiler will
detect the error, and the program won't even compile. At this point,
the programmer is unable to form an executable that a user can
run until the error is fixed.
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]

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)

Flow lines with arrowhead

Initialization

Input/output(display)

Process

Decision

On page Connector

Off-page connector

Predefined Process

Let's try to convert an algorithm to an equivalent 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]

Sample 1: Find the sum of two numbers


Algorithm Flowchart
1. Start
2. Initialize five to A, six to B and zero
to SUM
3. Add the value of A plus B then
store to SUM
4. Display the value of SUM
5. 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 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

Florence Tiu Balagtas (2006), Java Education & Development Initiatives(J.E.D.I.),


Introduction to Programming 1 version 3

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

You might also like