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

BIC 10204 Chapter 1 Introduction To Computer Programming

This document provides an introduction to computer programming. It discusses the history of computing, programming languages, the components of programming, and the phases of the software development lifecycle. It defines key programming concepts such as source code, programming languages, and the role of computer programmers. Examples of computer programs written in languages like Java and C++ are also presented to illustrate programming.

Uploaded by

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

BIC 10204 Chapter 1 Introduction To Computer Programming

This document provides an introduction to computer programming. It discusses the history of computing, programming languages, the components of programming, and the phases of the software development lifecycle. It defines key programming concepts such as source code, programming languages, and the role of computer programmers. Examples of computer programs written in languages like Java and C++ are also presented to illustrate programming.

Uploaded by

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

Faculty of Computer Science and Information Technology

BIC 10204 Algorithm and Programming


Chapter 1
Introduction to Computer
Programming

Introduction to Computer
Chap 1
Programming

After this lesson, you should be able to understand


or explain about:

history of computing
computer programming languages
components of programming
Phases of software development lifecycle

1
Introduction to Computer
Chap 1
Programming

Operating under the


An electronic device control of instruction stored
in its own memory

Accept data
Process data according to specific rules
Produce results
Store results for future use
3

Introduction to Computer
Chap 1
Programming

Milestones in computer history..

Please refer to the following book if you want to know


more about the history and evolution of computer..

by Shelly, Cashman and Vermaat

2
Introduction to Computer
Chap 1
Programming

What?
Why?

How? When?

Introduction to Computer
Chap 1
Programming

Computer program Source code

Programming Terminology Computer


language Programming

Programmer
6

3
Introduction to Computer
Chap 1
Programming

Also known as software


List/sequence of instructions to computer
What ?
consists of specific steps to be carried out by computer

Computer program How it works?

Instruct computer to do task or data processing


to produce useful information

Introduction to Computer
Chap 1
Programming

An example of a computer
program or software
written in C programming
language

4
Introduction to Computer
Chap 1
Programming

We can say that

A series of instructions
that tells a computer
what to do and how to do
a task.

Introduction to Computer
Chap 1
Programming

What ?
Also known as
any sequence of statements code snippet or
and/or declarations written program code
in some human-readable
computer programming
language.
One part of the whole
computer program.

10

5
Introduction to Computer
Chap 1
Programming

#include <stdio.h>

int first,second;
void addition(int x,int y);

void main()
{
printf("Enter first number:");
scanf("%d",&first); Source code
printf("Enter second number:");
scanf("%d",&second);
}

void addition(int x,int y)


{
Source code
add = x + y;
printf("The result of a + b = ",add);
}

11

Introduction to Computer
Chap 1
Programming

The process of writing, testing and maintaining


the source code of the computer program

?
What ?

Computer Programming

How to program ?
Requires knowledge in the application domain
Follow the steps in software development method

12

6
Introduction to Computer
Chap 1
Programming

Programming is a problem-
solving activity
To solve the problems
occurred in life with
the assistance of
computer To help improve daily process
e.g: transaction,
payroll,accounting, registration,
information exchange etc.
13

Introduction to Computer
Chap 1
Programming

?
A set of symbol, word, code or
instructions which is understood by
What ?
computer

Programming Language
Function?
Method of communication for which
computers could understand and execute
the instructions written in source code.

14

7
Introduction to Computer
Chap 1
Programming

Category Explanation
Machine language Binary number codes understood by a
specific CPU
Assembly Mnemonic codes that correspond to
language machine language instructions
High level Machine-independent programming
language language that combines algebraic
expressions and English symbols.

Computer programmers usually only


involve in writing high level language
15

Introduction to Computer
Chap 1
Programming

Language Application Area


FORTRAN Scientific programming High level
programming
COBOL Business data processing languages
LISP Artificial Intellingence
C System programming
C++ Supports objects and object-oriented
programming
Java Supports object-oriented, Web and mobile
programming.
16

8
Introduction to Computer
Chap 1
Programming

An example of a computer
program or software
written in JAVA
programming language

17

Introduction to Computer
Chap 1
Programming

An example of a computer
program or software
written in C++
programming language

18

9
Introduction to Computer
Chap 1
Programming

Those who are responsible to write


computer programs What ?

Computer programmer
How ?

Job involves requirement analysis, specification,


software architecture,coding, compilation, software
testing, documentation,integration and maintenance.

19

Introduction to Computer
Chap 1
Programming

Computer program

Programming Terminology Computer


language Programming

person
Programmer
20

10
Introduction to Computer
Chap 1
Programming

Input

Output
21

Introduction to Computer
Chap 1
Programming

Computer process data into information

Input Output

Process

22

11
Introduction to Computer
Chap 1
Programming

Any data and instruction


entered into the memory of
a computer

Data
A collection of
unprocessed items e.g:
text, numbers, images,
audio and video

23

Introduction to Computer
Chap 1
Programming

Computer mouse Keyboard

24

12
Introduction to Computer
Chap 1
Programming

is a naturally occurring or In computer


designed sequence of changes of processing,
properties or attributes of an data is turned
object or system into useful
information

25

Introduction to Computer
Chap 1
Programming

Data that has been


processed into a useful
form (information)

Information
result of processing,
manipulating and
organizing data in a way
that adds to the knowledge
of the receiver

26

13
Introduction to Computer
Chap 1
Programming

A computer generates
several types of in text,
output, depending on graphics, audio
the hardware and or video forms.
software being used
and user requirements

27

Introduction to Computer
Chap 1
Programming

Monitor Printer

28

14
Introduction to Computer
Chap 1
Programming

29

Introduction to Computer
Chap 1
Programming

Computer
programmer

WHAT Program ??

30

15
Introduction to Computer
Chap 1
Programming

Steps used to solve problem in Also known as


computer programming Software/ System
Development Life Cycle
(SDLC) or software
process
A development of a software/computer
program product.

31

Introduction to Computer
Chap 1
Programming

Specify problem

Steps Analyze problem

Design algorithm

Implement algorithm

Test and verify program

Maintain and update program


32

16
Introduction to Computer
Chap 1
Programming

What is the
What STATE problem?
problem to
be solved?
Is it possible to solve
the problem with
programming?

33

Introduction to Computer
Chap 1
Programming

State the
problem
clearly Gain a clear
understanding of
what are
required for its
solution.

34

17
Introduction to Computer
Chap 1
Programming

What is the
problem?
Given the value of x is 10 and a is 12,
find the result of the following equation: What to
solve?
y = 2x + a - 6
Is it possible to
solve the problem
with
programming?
35

Introduction to Computer
Chap 1
Programming

State the problem clearly

Problem What is the value of y?

Data Given the value of x and a

Solution Solve the equation using the given


values

36

18
Introduction to Computer
Chap 1
Programming

Uncle Degawan wants to buy 5 tins of paint from


Cindas shop. The price of each tin of the paint is
RM 15.60. Calculate the price which Uncle Degawan
have to pay for all the tin of paints he bought.

What data
What is the What to we have?
problem? solve?

37

Introduction to Computer
Chap 1
Programming

State the problem clearly

Problem What is the price for 5 tins of paint?

Data Given the price for one tin of paint


(RM15.60)
Solution Calculate the price of one tin of paint
with the amount of the paint tin

38

19
Introduction to Computer
Chap 1
Programming

Mrs Sue needs to determine her students grade for


programming subject based on the mark scored during
final examination. The A grade will be given if the mark
scored is between 85 to 100. If a student has scored 90
marks, what is the grade should Mrs Sue give to the
student?
What is the
What is the What data
solution?
problem? we have?

39

Introduction to Computer
Chap 1
Programming

State the problem clearly

Problem What is the grade?

Data A will be obtained if mark is between


85 to 100. The students mark is 95.

Solution Determine the grade based on the mark

40

20
Introduction to Computer
Chap 1
Programming

A box has height, width and length.


Calculate the volume of a box.

Problem Volume of a box

Data Box has height, width and length

Solution Get the height,width and length of a box.


Create formula for the box volume
41

Introduction to Computer
Chap 1
Programming

Calculate salary of an employee for


a month.

Problem Salary for a month

No specific data.
Data
Pay per day,working days
Get the pay per day and amount of
Solution
working days.
Calculate the salary.
42

21
Introduction to Computer
Chap 1
Programming

43

Introduction to Computer
Chap 1
Programming

44

22
Introduction to Computer
Chap 1
Programming

45

Introduction to Computer
Chap 1
Programming

IDENTIFY
Output
Input

Process

46

23
Introduction to Computer
Chap 1
Programming

Input
Given the value of x is 10 and a is 12,
find the result of the following equation:
Process
y = 2x + a - 6

Output

47

Introduction to Computer
Chap 1
Programming

Identify the problem

Input Value of x and a

Process Replace the value of x and a in the


formula, y = 2x +a -6
Output The value of the equation, y

48

24
Introduction to Computer
Chap 1
Programming

Uncle Degawan wants to buy 5 tins of paint from


Cindas shop. The price of each tin of the paint is
RM 15.60. Calculate the price which Uncle Degawan have
to pay for all the tin of paints he bought.

Output
Input Process

49

Introduction to Computer
Chap 1
Programming

Identify the problem

Input Amount of paint tin, price per tin

Develop a formula(s):
payment = amount x price per tin
Process

Output Payment for the paint(s)

50

25
Introduction to Computer
Chap 1
Programming

Mrs Sue needs to determine her students grade for


programming subject based on the mark scored during
final examination. The A grade will be given if the mark
scored is between 85 to 100. If a student has scored 90
marks, what is the grade should Mrs Sue give to the
student?

Output
Input Process

51

Introduction to Computer
Chap 1
Programming

Identify the problem

Input Mark

Process If mark is between 85 and 100, grade


will be A

Output Grade

52

26
Introduction to Computer
Chap 1
Programming

Given the following formula,calculate the


porosity of rock:
porosity = (pure volume /total rock volume) x 100%

Specify and analyze the problem

53

Introduction to Computer
Chap 1
Programming

Compute and display the total cost of apples given


the number of pounds of apples purchased and the
cost of apples per pound.

54

27
Introduction to Computer
Chap 1
Programming

Solve Problem

Develop a list of steps Verify that the algorithm


called algorithm solves the problem

55

Introduction to Computer
Chap 1
Programming

Writing program
Also known
Convert algorithm into as CODING
programming

56

28
Introduction to Computer
Chap 1
Programming

General steps involved Write program code with specific


programming language in specific
Coding programming tools/software

Write explaination/description for


each line of codes/comment for future
Documentation
references
Using tool/software function to check
Compile errors in program code

Execute/Run Using tool/software function to


display output of program

57

Introduction to Computer
Chap 1
Programming

Testing program
Executing program to see if it
To verify the program can produce correct results.If not
works as desired do debugging.

58

29
Introduction to Computer
Chap 1
Programming

Modifying program
USE and MODIFY the
Remove undetected errors program to meet changing
requirements or correct
and keep up-to-date errors that show up in using
it

59

Introduction to Computer
Chap 1
Programming

Specify problem

Steps Analyze problem

Design algorithm

Implement algorithm

Test and verify program

Maintain and update program


60

30
Introduction to Computer
Chap 1
Programming

61

Introduction to Computer
Chap 1
Programming

62

31
Introduction to Computer
Chap 1
Programming

1. Tan, H.H. dan DOrazio, T.B. 1999. C Programming for


Engineering & Computer Science. McGraw-Hill International
Editions. Call number: QA76.73 .C15 .T36 1999.
2. Hanly, J. R. dan Koffman, E.B. 2010. Problem Solving and
Program Design in C . Pearson Education.
3. Deitel, P. J. & Deitel H.M. 2010. C How to Program. 6th ed..
Pearson Education Inc. Call number: QA76.73.C15 .D45 2010.
4. Goyal, A. K. 2008. The C Programming Language. Alpha
Science. Call number: QA76.73.C15 .G69 2008.

63

32

You might also like