• No results found

CHAP 1: INTRODUCTION TO PROGRAMMING

N/A
N/A
Protected

Academic year: 2021

Share "CHAP 1: INTRODUCTION TO PROGRAMMING"

Copied!
67
0
0

Loading.... (view fulltext now)

Full text

(1)

CHAP 1: INTRODUCTION TO PROGRAMMING

(2)

Chapter 1

INTRODUCTION TO COMPUTER AND PROGRAMMING (4 HOURS)

Introduction to the computer and programming concepts

System Development Life Cycle phases

Definition of an essential programming design

through algorithm development: pseudo code and flowchart

(3)

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

(4)

Introduction to C language (assignment)

Example

Who developed C language?

When C is introduced?

etc

(5)

Chap 1 Introduction to Programming

LEARNING OBJECTIVE

After this lesson, student should be able to understand or explain about:

The history of computing

Computer programming concept

Components of computer programming

The Software Development Method

(6)

Chap 1 Introduction to Programming

An electronic device

Operating under the

control of instruction stored in its own memory

Accept data

Process data according to specific rules

Produce results

Store results for future use

(7)

What?

Why?

How? When?

(8)

Programming language

Computer program

Terminology Computer Programming Programmer

Source code

(9)

Computer program

•Also known as software

•List/sequence of instructions to computer

consists of specific steps to be carried out by computer

Instruct computer to do task or data processing to produce useful information

How it works?

What ?

(10)

Example of computer program

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

language

(11)

A series of instructions that tells a computer what to do

and how to do a task.

We can say that……

(12)

any sequence of statements and/or declarations written

in some human- readable computer

programming language.

Also known as code snippet or

program code

One part of the whole computer

program.

What ?

(13)

#include <stdio.h>

int first,second;

void addition(int x,int y);

void main() {

printf("Enter first number:");

scanf("%d",&first);

printf("Enter second number:");

scanf("%d",&second);

}

void addition(int x,int y) {

add = x + y;

printf("The result of a + b = ",add);

}

Source code Source code

Example of source code

(14)

Computer Programming

The process of writing, testing and maintaining the source code of the computer program

•Requires knowledge in the application domain

•Follow the steps in software development method

How to program ? What ?

?

(15)

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.

Programming is a

problem-solving activity

(16)

Programming Language

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

computer

Method of communication for which computers could understand and execute

the instructions written in source code.

Function?

What ?

?

(17)

Computer languages

Category Explanation

Machine language Binary number codes understood by a specific CPU

Assembly language

Mnemonic codes that correspond to machine language instructions

High level language

Machine-independent programming language that combines algebraic expressions and English symbols.

Computer programmers usually only involve in writing high level language

(18)

Examples of programming language

Language Application Area FORTRAN Scientific programming

COBOL Business data processing LISP Artificial Intellingence

C System programming

C++ Supports objects and object-oriented programming

Java Supports object-oriented, Web and mobile programming.

High level programming

languages

(19)

An example of a computer program or software

written in JAVA programming language

Example of computer program

(20)

An example of a computer program or software

written in C++

programming language

Example of computer program

(21)

Computer programmer

Those who are responsible to write

computer programs What ?

How ?

Job involves requirement analysis, specification, software architecture,coding, compilation, software testing, documentation,integration and maintenance.

(22)

Programming language

Computer program

Terminology Computer Programming Programmer

person

The Concept of Computer Programming

(23)

Input

Output

(24)

Input Output Process

Computer process data into information

Components of computer programming

(25)

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

(26)

Computer mouse Keyboard

(27)

is a naturally occurring or

designed sequence of changes of properties or attributes of an

object or system

In computer processing, data is turned

into useful information

(28)

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

(29)

A computer generates several types of

output, depending on the hardware and software being used and user requirements

in text,

graphics, audio or video forms.

(30)

Monitor Printer

(31)
(32)

Computer programmer

WHAT Program ??

(33)

Also known as Software/

System Development Life Cycle

(SDLC) or software process

A development of a

software/computer program product.

Steps used to solve problem in computer programming

(34)

Specify problem Analyze problem Design algorithm Implement algorithm Test and verify program Maintain and update program

Steps

(35)

STATE

What

problem to be solved?

What is the problem?

Is it possible to solve the problem with

programming?

(36)

State the problem

clearly Gain a clear

understanding of what are

required for its solution.

(37)

Given the value of x is 10 and a is 12,

find the result of the following equation:

y = 2x + a - 6

What is the problem?

Is it possible to solve the problem

with

programming?

What to solve?

(38)

Problem What is the value of y?

Data Given the value of x and a

Solution Solve the equation using the given values

State the problem clearly

(39)

Uncle John wants to buy 5 tins of paint from Cinda’s shop. The price of each tin of the paint is

RM 15.60. Calculate the price which Uncle John have to pay for all the tin of paints he bought.

What is the problem?

What to solve?

What data we have?

(40)

Problem What is the price for 5 tins of paint?

Data Given the price for one tin of paint

Solution Calculate the price of one tin of paint with the amount of the paint tin

State the problem clearly

(41)

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 problem?

What data we have?

What is the solution?

(42)

Problem What is the grade?

Data ‘A’ will be obtained if mark is between 85 to 100. The student’s mark is 95.

Solution Determine the grade based on the mark State the problem clearly

(43)

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

(44)

Calculate salary of an employee for a month.

Problem Salary for a month

Data No specific data.

Pay per day,working days

Solution Get the pay per day and amount of working days.

Calculate the salary.

(45)
(46)
(47)
(48)

IDENTIFY

Input Output

Process

(49)

Given the value of x is 10 and a is 12,

find the result of the following equation:

y = 2x + a - 6

Input

Output

Process

(50)

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

Identify the problem

(51)

Uncle John wants to buy 5 tins of paint from

Cinda’s shop. The price of each tin of the paint is RM 15.60. Calculate the price which Uncle John have to pay for all the tin of paints he bought.

Input Process Output

(52)

Input Amount of paint tin, price per tin

Process Develop a formula(s):

payment = amount x price per tin

Output Payment for the paint(s) Identify the problem

(53)

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?

Input Process Output

(54)

Input Mark

Process If mark is between 85 and 100, grade will be A

Output Grade

Identify the problem

(55)

Given the following formula, calculate the porosity of rock:

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

Specify and analyze the problem

(56)

Compute and display the total cost of apples given the number of pounds of

apples purchased and the cost of apples per pound.

(57)

Develop a list of steps called algorithm

Verify that the algorithm solves the problem

Solve Problem

(58)

Convert algorithm into programming

Writing program

Also known as CODING

(59)

Coding

General steps involved

Documentation Compile

Execute/Run

Write program code with specific programming language in specific

programming tools/software

Write explaination/description for each line of codes/comment for future

references

Using tool/software function to check errors in program code

Using tool/software function to display output of program

(60)

To verify the program can works as desired

Testing program

Executing program to see if it produce correct results.If not

do debugging.

(61)

Remove undetected errors and keep up-

to-date

Modifying program

USE and MODIFY the program to meet

changing

requirements or correct errors that show up in using it

(62)

Specify problem Analyze problem Design algorithm Implement algorithm Test and verify program Maintain and update program

Steps

(63)

EXAMPLE

(64)

Drink Stall

State the Problems clearly

customers come no matter the time

1 worker

Time to pray? Eat? ????

Auto transaction (customer)

(65)

Drink Stall

State the Problems clearly

Problem = How much to pay?

Data = Number of item, Price per item

Solution = calculate number of item with price per item

• Without changing the steps

(66)

Analyze the problem

Input : type of drinks, number of drinks

Process : calculate the total price according to type of drinks and number of drinks

Output : Price to pay

(67)

Next topic:

Chapter 1 Part 2 : Algorithm

References

Related documents

Computershare South Africa manages over 2 million shareholder accounts, providing share registry and custodial services, employee share plan management and investor relations for

Teaches graduate students how to find resources and funds to finance their graduate education by exploring the various types and sources of student aid (including free sources

Analyze Programming Problems and Flowchart Solutions Design Program Solutions Code Programs Test Programs Maintain Programs Complete User Documentation and Technical Writing

A formal Research Mentoring Programme (REMP) has been proposed by the researchers as a possible research capacity development strategy to improve research output.. The

Through further analysis of the quantitative data (GPAs and retention rates) and conducting qualitative research through questionnaires and one-on-one interviews, it was the hope

The students will apply grade-level skills (summary) to text of their choosing Engagement Constructs Motivational Constructs Skill/ Strategy Innovative Instructional

We present a general algorithm, pre-determinization, that makes an arbitrary weighted transducer over the tropical semiring or an arbitrary unambiguous weighted transducer over

Outline The Problem The Solution Variants 1 The Problem Introduction Solutions 2 The Solution Algorithm Efficiency 3 Variants... Outline The Problem The