Anda di halaman 1dari 11
KKKK KKKK EEEE EEEE MMMM MMMM EEEE EEEE NNNN NNNN TTTT TTTT EEEE EEEE RRRR RRRR

KKKKKKKKEEEEEEEEMMMMMMMMEEEEEEEENNNNNNNNTTTTTTTTEEEEEEEERRRRRRRRIIIIIIIIAAAAAAAANNNNNNNN PPPPPPPPEEEEEEEELLLLLLLLAAAAAAAAJJJJJJJJAAAAAAAARRRRRRRRAAAAAAAANNNNNNNN MMMMMMMMAAAAAAAALLLLLLLLAAAAAAAAYYYYYYYYSSSSSSSSIIIIIIIIAAAAAAAA

SSSSSSSSeeeeeeeellllllllffffffff AAAAAAAAcccccccccccccccceeeeeeeessssssssssssssss LLLLLLLLeeeeeeeeaaaaaaaarrrrrrrrnnnnnnnniiiiiiiinnnnnnnngggggggg MMMMMMMMoooooooodddddddduuuuuuuulllllllleeeeeeee

IIICCCTTT LLLiiittteeerrraaacccyyy fffooorrr SSSeeecccooonnndddaaarrryyy SSSccchhhoooooolll PPPrrrooogggrrraaammmmmmeee

KKKK KKKK EEEE EEEE MMMM MMMM EEEE EEEE NNNN NNNN TTTT TTTT EEEE EEEE RRRR RRRR
KKKK KKKK EEEE EEEE MMMM MMMM EEEE EEEE NNNN NNNN TTTT TTTT EEEE EEEE RRRR RRRR

Curriculum Development Division Ministry of Education Malaysia

ICTL For Secondary School --Visual Basic Express Module

ICTL For Secondary School --Visual Basic Express Module MODULE 1 P P R R O O

MODULE 1

PPRROOGGRRAAMMMMIINNGG

IInnttrroodduuccttiioonn ttoo pprrooggrraammmmiinngg

ICTL For Secondary School --Visual Basic Express Module MODULE 1 P P R R O O
ICTL For Secondary School --Visual Basic Express Module MODULE 1 P P R R O O

Curriculum Development Division Ministry of Education Malaysia

ICTL For Secondary School --Visual Basic Express Module

ICTL For Secondary School --Visual Basic Express Module 1. Name of Module : Introduction to programming
  • 1. Name of Module

: Introduction to programming

  • 2. Learning Outcomes

: The students should be able to:-

  • a. Define programming

  • b. State the main steps in programme development.

  • 3. Knowledge and Skills

:

  • a. Definition of programme

  • b. Programming language.

  • 4. Module Summary

: At the end of the module, student should be able to :-

  • a. Understand the definition of programming language.

  • b. Understand the phases of Program Development.

ICTL For Secondary School --Visual Basic Express Module

ICTL For Secondary School --Visual Basic Express Module Introduction Introduction Introduction totototo programming Introduction programming programming

Introduction Introduction

Introduction totototo programming

Introduction

programming programming

programming

  • 1.1 What is programme? Programme refers to a series of organize instruction that directs the computer to do something for us with the help of programming language.

  • 1.2 What is a programming language?

A Programming Language is a set of rules that provides a way of telling the computer what operation to perform (according to Capron and Johnson,2004)

  • 1.3 What programming languages are available? These programming languages are generally divided into five levels or generations. The following are the descriptions of each level of programming language:-

Level of language / Generations

 

Descriptions

Machine Language ( First generation )

Computer understands only binary number- strings of 0 and 1.

Programs that are written in these 0 and 1 represent the “on” and “off”.

 

This programming language is considered very

Assembly Language ( Second Generation)

low level. This language use mnemonic codes such as: A

 

for add, C for compare, MP for multiply. This language is closer to human language

High-Level Language (Third Generation)

compare to the machine language. designed to be easier for a human to understand

3GL

Examples: VISUAL BASIC, ALGOL 58, 60 and 68, COBOL, FORTRAN IV, ADA and C++.

Very High-Level Language

This programming language is an improvement of high-level language.

( Fourth Generation or

Designed to reduce programming effort

4GL)

Examples: SHEERPOWER, OpenEdge ABL and Informix-4GL

 

This language is similar to spoken or written English Language.

Natural Language (Fifth Generation )

The natural language translates human instructions into code.

Examples: PROLOG, MERCURY and OPS5.

Figure 1: Level of programming language

ICTL For Secondary School --Visual Basic Express Module

ICTL For Secondary School --Visual Basic Express Module Let’s look at some of the examples of

Let’s look at some of the examples of each interface for the programming languages:-

  • a) Example of C programming (taken from http://encyclopedia.laborlawtalk.com/wiki/images/thumb/5/5c/500px-Qbasic.png time downloaded on16.6.2006).

ICTL For Secondary School --Visual Basic Express Module Let’s look at some of the examples of

Figure 2: C programming

  • b) Example of C++ programming (taken from http://www.originlab.com/www/products/images/origin_c_code_492px.gif downloaded on 16.6.2006).

ICTL For Secondary School --Visual Basic Express Module Let’s look at some of the examples of

Figura 3: C++ programming

ICTL For Secondary School --Visual Basic Express Module

ICTL For Secondary School --Visual Basic Express Module c) Example of Visual Basic taken from (www.dmst.aueb.gr/dds/etech/swdev/env.gif)
  • c) Example of Visual Basic taken from (www.dmst.aueb.gr/dds/etech/swdev/env.gif) downloaded on 16.6.2006)

ICTL For Secondary School --Visual Basic Express Module c) Example of Visual Basic taken from (www.dmst.aueb.gr/dds/etech/swdev/env.gif)

Figure 4: Visual Basic 6 Programming

  • d) Example of Pascal (taken from http://www.freedownloaddevelopment.com/delphi/pascal-look.html downloaded on 16.6.2006).

ICTL For Secondary School --Visual Basic Express Module c) Example of Visual Basic taken from (www.dmst.aueb.gr/dds/etech/swdev/env.gif)

Figure 5: Pascal Programming

ICTL For Secondary School --Visual Basic Express Module

ICTL For Secondary School --Visual Basic Express Module e) Example of Fortran programming (taken from http://homepage.cs.uri.edu/faculty/wolfe/book/Readings/Reading13.htm
  • e) Example of Fortran programming (taken from

http://homepage.cs.uri.edu/faculty/wolfe/book/Readings/Reading13.htm

downloaded on 16.6.2006).

ICTL For Secondary School --Visual Basic Express Module e) Example of Fortran programming (taken from http://homepage.cs.uri.edu/faculty/wolfe/book/Readings/Reading13.htm

Figure 6: Fotran Programming

  • g) Example of Java programming (taken from http://ssrlibrary.ca/~megatron/images/screenshots/eclipse.png

downloaded on 16.6.2006)

ICTL For Secondary School --Visual Basic Express Module e) Example of Fortran programming (taken from http://homepage.cs.uri.edu/faculty/wolfe/book/Readings/Reading13.htm

Figure 7: Java Programming

ICTL For Secondary School --Visual Basic Express Module

ICTL For Secondary School --Visual Basic Express Module The Program Development Life Cycle When we want

The Program Development Life Cycle

When we want to produce a program, we need to go through a few phases. There are five main phases in program development;

PHASE 1 Problem Analysis PHASE 2 Program Design
PHASE 1
Problem
Analysis
PHASE 2
Program
Design
ICTL For Secondary School --Visual Basic Express Module The Program Development Life Cycle When we want
ICTL For Secondary School --Visual Basic Express Module The Program Development Life Cycle When we want

PHASE 5

Documenting

The

Programme

ICTL For Secondary School --Visual Basic Express Module The Program Development Life Cycle When we want

PHASE 4

 

PHASE 3

Testing and

Testing and Coding

Coding

Debugging

The problem

Figure 8: Program Development Life Cycle

Let’s look at the descriptions of each main phase in program development:

  • 1. Problem Analysis What is problem analysis? The programmer need to identify and analyst the problem before developing a programme. (Example: interview the client to get information of problems).

  • 2. Program Design Before a programme is developed it has to be design using algorithm. An algorithm is a set of steps that is able to solve a problem. It can be expressed in many ways such as Pseudo code and Flowcharts.

ICTL For Secondary School --Visual Basic Express Module

ICTL For Secondary School --Visual Basic Express Module 2.1 Pseudo code A pseudo code is a

2.1 Pseudo code

A pseudo code is a mixture of Computer and English language, used for planning program logic.

Example : The following pseudocode is to input (Key-in) two marks (math & Science) and output (display) the total mark.

BEGIN ; INPUT math mark INPUT science mark Total = math mark + science mark DISPLAY Total; End ;

2.2 Flowcharts

Symbol

Name

 

Description

 
 

Start / Stop

Shows the Start and flowcharts

End

of

the

Shows any function an Input /
 

Shows

any

function

an

Input

/

Input / Output

Output device.

 
Decision Shows the Selection of an option depends on a given condition.

Decision

Shows the Selection of an option depends on a given condition.

Process Shows the function like Calculations.

Process

Shows the function like Calculations.

 
Connector If the page is not enough, used to

Connector

If

the

page is

not

enough, used to

continue to the next page.

 
Flow lines Used to give the direction of the flow

Flow lines

Used to give the direction of the flow

of data / information.

of data / information.

 

Table 1 : Flowcharts Symbols

ICTL For Secondary School --Visual Basic Express Module

ICTL For Secondary School --Visual Basic Express Module Draw a flowchart to enter your Math and

Draw a flowchart to enter your Math and Science marks and output shows the Total of Math and Science marks.

Start

Enter Math Mark, Science Mark
Enter
Math Mark,
Science Mark
Total = Math Mark + Science Mark Output Total
Total = Math Mark
+ Science Mark
Output
Total

End

Figure 9. Example of a Flowchart:

Exercise:

Draw a flowchart to enter 3 marks (Math, Science and English )and output the total marks.

ICTL For Secondary School --Visual Basic Express Module Draw a flowchart to enter your Math and

ICTL For Secondary School --Visual Basic Express Module

ICTL For Secondary School --Visual Basic Express Module 3. Coding Coding is to translate the logic
  • 3. Coding Coding is to translate the logic from the flowchart or pseudo code into code

  • 4. Testing and Debugging Testing is to find error of the programme, the process of finding error is debugging.

  • 5. Documentation Documentation is important when programming. The document helps a programmer to update and upgrade the programme. A document consists of problem analysis, pseudo code, flowcharts, code, user manual, a clear layout of the input and output records about the programme.