You are on page 1of 33

True

True
Condition
Condition False
False

Action
Action11 Action
Action22
FLOW
FLOWCHART
CHART
CONTROL
CONTROL
STRUCTURE OPERATOR
OPERATOR
STRUCTURE

DATA
DATA
DEFINITION
DEFINITION PROGRAMMING TYPES
TYPES

LEVEL
LEVEL&&
GENERATION CONSTANT
CONSTANT&&
GENERATION
VARIABLE
VARIABLE
DEVELOPMENT
DEVELOPMENT
PHASES TRANSLATOR
TRANSLATOR
PHASES
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
1010 1001001 100101
MACHINE LANGUAGE 2 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.
1010 1001001 100101
MACHINE LANGUAGE
2 1110111 000110

ASSEMBLY LANGUAGE

ASSEMBLER
HIGH LEVEL LANGUAGE
IF MARKS > 50 THEN

INTERPRETER PRINT LULUS


ELSE
PRINT GAGAL
COMPILER END IF
are programs that translate
high level language into machine language

High Level Machine


into
Language 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 Dim Name as String


Const GRAVITY = 9.8 examples 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 String data type contains a sequence
(Text) of character.
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
107 students
Integer Whole numbers
-60 Celcius
RM 123.45
Double Decimal numbers
3.5 kg
Abu Hassan
String Text information
Jalan Bahagia
Boolean Logical values True or False
Date Date or time 12/5/2008
Variant 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
positive values
Double Decimal numbers -1.79769313486232E308 to
-4.94065645841247E-324 for negative values
and 4.94065645841247E-324 to
1.79769313486232E308 for positive values
Currency Numbers with up to 922,337,203,685,477.5808 to
15 digits left of the 922,337,203,685,477.5807
decimal and 4 digits
right of the decimal
String Text information 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
information
Variant Any of the preceding N/A
datatypes
An operator is a symbol that causes VB to take an action

causes the left side operand


Assignment Operator to have right side value

to perform mathematical
Mathematical Operator operations

to compare two value and


Comparison Operator return value whether true or false

to perform logical operations


Logical Operator and return value whether true
or false
Age = 17

operand Asssignment operator


Mathematical Logical
Meaning Meaning
Operator Operator

And
+ Plus And Operator
Or
- Minus Or Operator
Not
* Multiply Not Operator

/ Divide
Comparison Comparison
Meaning
Operator Operator

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

= Equal

<> Not Equal


Action 1
True Condition False

Action 1 Action 2
Action 2

Action 3
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
Dim Number3 as Double
Dim Average as Double Get Number1
Get Number2
Input Get Number3
Number1 = txtNumber1.text
Number2 = txtNumber2.text
Number3 = txtNumber3.text
Average = (Number1 +
Process Number2 + Number3)/
Average = (Number1 + Number2 + Number3)/3 3

Output
txtAverage.text = Average Print 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

parallelogram
READ / PRINT

FORMULA
rectangle

oval

IF THEN - ELSE
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.

Sub GetInput (x as integer)


GetInput (x, y) Input Number 1 ; x
Input Number 2 ; y
End Sub
z = Process (x, y)
Function Process (x as integer) as integer
DisplayResult (z) 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
Const PI = 3.142
Dim mRadius As Single
Dim myCircle As New aCircle
Function Diameter() As Single
Return 2 * mRadius myCircle.Radius = 10
End Function
Print myCircle.Area
Function Area() As Single Print myCircle.Diameter
Return PI * mRadius * mRadius Print myCircle.Circumference
End Function

Function Circumference() As Single


Return 2 * PI * mRadius
End Function
End Class
1

4
1

3
classCircle
class Circle{ {
main()
{ data privateint
private intradius;
radius;
int radius;
publicvoid
public voidsetRadius(int
setRadius(intr)r){ {
cout << Area of circle is << radius==r;r;
radius
getArea(4); }}
cout << Circumference of circle is << publicdouble
public doublegetArea()
getArea(){ {
getCircumference(4); doublearea;
double area;
} area==3.142
area 3.142* *radius
radius* *radius;
radius;
returnarea;
return area;
double getArea(int r) { function }}
double area; }}
area = 3.142 * r * r;
return area; class FindCircle {
} public static void main() { object
double getCircumference(int r) Circle circle1;
{ circle1.setRadius(4);
double circumference; cout << Area of circle is <<
circumference = 2 * 3.142 * r ; circle1.getArea();
return circumference; }
}

You might also like