The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by WB.ALI, 2016-01-28 19:11:03

PROGRAMMING

ICT PROGRAMMING

Keywords: ICT PROGRAMMING

TrTureue CCoonndditiitoionn FaFlaslese

AAcctitoionn11 AAcctitoionn22

CCOONNTTRROOLL FFLLOOWWCCHHAARRTT
SSTTRRUUCCTTUURREE
OOPPEERRAATTOORR

DDEEFFININITITIOIONN PROGRAMMING DDAATTAA
TTYYPPEESS

LLEEVVEELL&& CCOONNSSTTAANNTT&&
GGEENNEERRAATTIOIONN VVAARRIAIABBLLEE

DDEEVVEELLOOPPMMEENNTT TTRRAANNSSLLAATTOORR
PPHHAASSEESS

FIRST THIRD FIFTH
GENERATION GENERATION GENERATION

SECOND FOURTH
GENERATION GENERATION

FIRST SECOND THIRD FOURTH FIFTH
GENERATION GENERATION GENERATION GENERATION GENERATION

Machine Assembly High Level Very High Natural
Language Language Language Level Language
Language
BASIC
FORTRAN

C
C++
C#
JAVA

MACHINE LANGUAGE 1010 1001001 100101
1101 1110111 000110
1001 101010 1001101

ASSEMBLY LANGUAGE

HIGH LEVEL LANGUAGE

n=1 HIGH LEVEL LANGUAGE

Do

If class =“5S2” Then

name[n] = NameFromFile

End If

n=n+1

Loop Until EOF(student)

VERY HIGH LEVEL LANGUAGE

SELECT SUM(total_price) FROM sales WHERE month = Feb
SELECT student FROM datafile WHERE class = 5S2

NATURAL LANGUAGE
Get me computer sales in February.
List me students from class 5S2.

MACHINE LANGUAGE 1010 1001001 100101
1101 1110111 000110
ASSEMBLY LANGUAGE

ASSEMBLER

HIGH LEVEL LANGUAGE IF MARKS > 50 THEN
PRINT “LULUS”
INTERPRETER
COMPILER ELSE
PRINT “GAGAL”

END IF

are programs that translate
high level language into machine language

High Level Machine
Language into Language

Source Code Object Code
(High Level Language) (Machine Language)

10 Input “Number 1” ; x 0010001 010010 0000100
20 Input “Number” ; y 0001001 001000 0010000
30 z = x + y 0010001 010010 0000001
40 Print “Answer “ ; z 0010011 010101 1010101



Constants difference Variables

Constants Variables

retain can change

their value characteristics their value

during the program during the program

execution. execution.

Const PI = 3.142 examples Dim Name as String
Const GRAVITY = 9.8 Dim Score as Integer
Const WAGE = 5.5 Dim Mark as Integer

Data types Explanation
Integer data type contains any whole
Integer number value that does not have
(Number) any frictional part.
Double data type contains any
Double decimal number value that has a
(Number) fractional part.
String data type contains a sequence
String of character.
(Text)
Boolean Boolean data type contains either a
(Logical true or false value.
Value)
Date data type contains date and
Date time value.

Datatype Value Examples
Integer
Whole numbers 107 students
Double -60 Celcius

String Decimal numbers RM 123.45
Boolean 3.5 kg
Date
Variant Text information Abu Hassan
Jalan Bahagia

Logical values True or False

Date or time 12/5/2008

Any datatypes N/A

Integer Whole numbers -32,768 to 32,767
Long Whole numbers Approximately +/- 2.1E9
Byte Whole numbers 0 to 255
Single Decimal numbers -3.402823E38 to -1.401298E-45 for negative
values and 1.401298E-45 to 3.402823E38 for
Double Decimal numbers positive values
-1.79769313486232E308 to -
Currency Numbers with up to 4.94065645841247E-324 for negative values
15 digits left of the and 4.94065645841247E-324 to
String decimal and 4 digits 1.79769313486232E308 for positive values
right of the decimal 922,337,203,685,477.5808 to
Text information 922,337,203,685,477.5807

Up to 65,000 characters for fixed-length strings
and up to 2 billion characters for dynamic strings

Boolean Logical values True or False
Date
Date and time Jan 1st 100 to December 31st 9999
Variant information

Any of the preceding N/A
datatypes

An operator is a symbol that causes VB to take an action

Assignment Operator causes the left side operand
to have right side value

Mathematical Operator to perform mathematical

operations

Comparison Operator to compare two value and
return value whether true or false

Logical Operator to perform logical operations
and return value whether true
or false

Age = 17

operand Asssignment operator

Mathematical Meaning Logical Meaning
Operator Operator
And
+ Plus And Operator

- Minus Or Or
Operator
* Multiply Not
Not
Operator

/ Divide

Comparison Meaning Comparison
Operator Operator

> Greater >= Greater
than Than or
<=
< Less than equal

Less
Than or

equal

= Equal

<> Not Equal

Action 1 True Condition False
Action 2
Action 3 Action 1 Action 2

BEGIN

READ Number Of Share BEGIN

IF Number Of Share >= 1 THEN

Dividend = Number Of Share x 5 %

PRINT Dividend READ
ELSE Number of
Share
PRINT Error Message

END IF

END False

True

END

Declaration BEGIN
Dim Number1 as Double
Dim Number2 as Double Get Number1
Dim Number3 as Double Get Number2
Dim Average as Double Get Number3

Input Average = (Number1 +
Number1 = txtNumber1.text Number2 +
Number2 = txtNumber2.text Number3)/3
Number3 = txtNumber3.text

Process
Average = (Number1 + Number2 + Number3)/3

Output Print Average
txtAverage.text = Average

END

Syarat Kemasukan SERATA

• Bahasa Arab = Lulus Logical Operator

• Bilangan A > 4 Comparison Operator

If BahasaArab = Lulus And BilA > 4 Then
DiTerima Masuk Serata

Else
Sila mohon ke sekolah lain

End If



arrow

parallelogram

rectangle

oval
diamond

arrow

parallelogram

rectangle

oval
diamond

arrow

READ / PRINT parallelogram
rectangle
FORMULA
IF – THEN - ELSE
oval

BEGIN / END diamond

Structured Approach is a computer programming
technique in which the program is divided
into modules like function or subroutine.

Object Oriented Approach is a computer programming
techniques based on the concept of an “object” that
combine both data and the function into a single unit.

10 INPUT “X”

20 IF X = 2 THEN GOTO 60 ELSE GOTO 90

30 PRINT “NUMBER ”;X
40 PRINT “PLEASE TRY AGAIN”

50 END
60 PRINT “NUMBER “;X
70 PRINT “GOOD”

90 END

Structured Approach is a computer programming
technique in which the program is divided
into modules like function or subroutine.

GetInput (x, y) Sub GetInput (x as integer)
z = Process (x, y) Input “Number 1” ; x
DisplayResult (z) Input “Number 2” ; y

End Sub

Function Process (x as integer) as integer
Process = x + y

End Function

Sub DisplayResult (x as integer)
Print x;”+”;y;”=“;z

End Sub

Object Oriented Approach is a computer programming
techniques based on the concept of an “object” that

combine both data and the function into a single unit.

Class aCircle Dim myCircle As New aCircle

Const PI = 3.142 myCircle.Radius = 10
Dim mRadius As Single
Print myCircle.Area
Function Diameter() As Single Print myCircle.Diameter
Return 2 * mRadius Print myCircle.Circumference

End Function

Function Area() As Single
Return PI * mRadius * mRadius

End Function

Function Circumference() As Single
Return 2 * PI * mRadius

End Function
End Class

1
2
3
4

1
2
3




Click to View FlipBook Version