View
214
Download
0
Embed Size (px)
Citation preview
8/4/2019 Basic Element
1/49
PRESENTED BY :
8/4/2019 Basic Element
2/49
8/4/2019 Basic Element
3/49
Learning Objectives
At the end of this lesson, you should be able to :
Differentiate between constants and variables.
Differentiate between the data types : Integer, Double,
String, Boolean and date.
Differentiate between mathematical and logical
operators.
Differentiate between sequence control structure andselection control structure.
8/4/2019 Basic Element
4/49
&
8/4/2019 Basic Element
5/49
CONSTANTS Constant is a virtual data container that stores
information.
The value will never change (remains constant) atany time during the course of a program.
VARIABLES
Variables is a virtual data container that storesinformation.
The value inside may change at any time duringthe course of a program
DEFINITION
8/4/2019 Basic Element
6/49
8/4/2019 Basic Element
7/49
const pi = 3.142
const MARGIN = 10
8/4/2019 Basic Element
8/49
8/4/2019 Basic Element
9/49
8/4/2019 Basic Element
10/49
CONSTANT VARIABLES
Characteristics Value is not
changeable during
the course of the
program
Value can be change
anytime during the
course of the
program
Usage Use constants when
you want to declare
something thatwontbe changed midway
in your program
execution
Use variables to store
data that may or will
change during therunning of the
program
CONCLUSION
8/4/2019 Basic Element
11/49
ACTIVITY
8/4/2019 Basic Element
12/49
CONSTANTS VS VARIABLES
________________ ____________________________ Value is
________________
during the course of
the program
Value
________________
anytime during the
course of theprogram
____________ Use constants when
you want to declaresomething that
________________
midway in your
program execution
Use variables to store
data that________________
during the running
of the program
8/4/2019 Basic Element
13/49
DATA TYPES
8/4/2019 Basic Element
14/49
?
?
?
8/4/2019 Basic Element
15/49
LEARNING OUTCOME
At the end of the lesson, you should be able to
differentiate types of data that consists of :
Integer Double
String
Boolean
Date
8/4/2019 Basic Element
16/49
STANDARD DATA TYPES
DATEDOUBLE STRING BOOLEANINTEGER
8/4/2019 Basic Element
17/49
What is Data Types
Data types determines the type of data a variable
can store, for example a number or a character
8/4/2019 Basic Element
18/49
INTEGER
MAIN
8/4/2019 Basic Element
19/49
DOUBLE
Any number value that may contain a
fractional part or decimal point
Example :
1.2,
,
MAIN
8/4/2019 Basic Element
20/49
STRING
www.themegallery.com
MAIN
8/4/2019 Basic Element
21/49
BOOLEAN
Boolean provide two value either
TRUE or FALSE
Programmers usually use it to store status Example :
If (marks40)
score = PASS;else
score = FAIL
TRUE
FALSE
MAIN
8/4/2019 Basic Element
22/49
Declare a date value
Example : DD/MM/YY -> Date/Month/Year
26/01/09
DATE
NEXT
8/4/2019 Basic Element
23/49
www.themegallery.com
TYPE OF DATA DEFINITION EXAMPLE
INTEGER Any number that containwhole number that does not
have fractional part
1, 2, 100, 1090
DOUBLE Any number value that maybecontain a fractional part or
decimal point
1.2, ,
STRING Non-numerical that contain asequence of characters Name, address
BOOLEAN value either TRUE or FALSE If (marks40)
score = PASS;
else
score = FAIL
DATE Declare a date value DD/MM/YY
8/4/2019 Basic Element
24/49
www.themegallery.com
CONCLUSION
STANDARD DATA TYPES
DATEDOUBLE STRING BOOLEANINTEGER
8/4/2019 Basic Element
25/49
ACTIVITY
www.themegallery.com
1. There are several labels here.
2. I need volunteers to take the labels and paste them on the mahjongpaper
8/4/2019 Basic Element
26/49
MATHEMATICAL AND LOGICAL
OPERATORS
Operator is a symbol or
notation that tells a
computer to perform
certain actions oroperations.
Lets look at some
examples of
Mathematical Operators
8/4/2019 Basic Element
27/49
MATHEMATICAL AND LOGICAL
OPERATORS
8/4/2019 Basic Element
28/49
MATHEMATICAL AND LOGICAL
OPERATORS
Let's look at some examples of Relational Operators
8/4/2019 Basic Element
29/49
MATHEMATICAL AND LOGICAL
OPERATORS
Let's look at some examples of Logical Operators.
8/4/2019 Basic Element
30/49
DIFFERENCES
Logical operatorsperform logical
operations such as
checking the condition
of two Boolean values.
Relational operatorsperform element-by-element comparisons
between two
arrays.
Mathematical operatorsperform mathematical
operations such as plus
or substract.
8/4/2019 Basic Element
31/49
DIFFERENCES OF OPERATORS SYMBOL
These operators have their own symbols based on theprogramming language.
8/4/2019 Basic Element
32/49
Activity 3Instruction: Choose and click the correct answer.1. Operator is a program or software that tells the computer to perform certain actions
or operations.
2. An example of a logical operator is the plus (+) operation which will tell the
computer to perform the add operation.
3. Mathematical operators tell the computer to perform mathematical operations that aresimilar to operators in mathematics.
4. Some examples of logical operation are: AND, OR and NOT.
5. Mathematical operators perform logical operations such as checking the condition oftwo Boolean values.
FALSETRUE
TRUE
TRUE
TRUE
TRUE
FALSE
FALSE
FALSE
FALSE
8/4/2019 Basic Element
33/49
HOME
8/4/2019 Basic Element
34/49
HOMENEXT
8/4/2019 Basic Element
35/49
CONTROL STRUCTURE
Structure of statements in programmingthat allows the programmer to control theflow of a program.
8/4/2019 Basic Element
36/49
Differences between selection
control and sequence control
Execution Flow
Usage
Flow Chart
8/4/2019 Basic Element
37/49
DIFFERENCE BETWEEN SELECTION CONTROLAND SEQUENCE CONTROL
8/4/2019 Basic Element
38/49
DIFFERENCE BETWEEN SELECTION CONTROLAND SEQUENCE CONTROL
8/4/2019 Basic Element
39/49
DIFFERENCE BETWEEN SELECTION CONTROLAND SEQUENCE CONTROL
8/4/2019 Basic Element
40/49
ACTIVITY
8/4/2019 Basic Element
41/49
1. _______________ refers to the linear execution of
codes within a program. Its statements areexecuted one by one in consecutive order.
2._____________enables the programmer to assigndifferent events for different situations. Programmers
can use it to implement decision making processwithin its program.
Sequence Control Selection Control
Sequence Control Selection Control
8/4/2019 Basic Element
42/49
3. Control structure is a method or technique that
allows the programmer to control the flow of aprogram.
4. If else statement is an example of sequencecontrol structures.
FalseTrue
FalseTrue
8/4/2019 Basic Element
43/49
EXCELENT!!!GOOD JOB.
Q1 Q2 Q3 Q4
8/4/2019 Basic Element
44/49
SORRYTRY AGAIN
Q1 Q2 Q3 Q4
8/4/2019 Basic Element
45/49
h
8/4/2019 Basic Element
46/49
QUIZ - MatchConstants
Variables
Integer
Double
String
Boolean
Date
Mathematical operators
Relational operators
Logical operators
Sequence Control
Structure
Selection Control Structure
1
2
3
4
5
6
7
8
9
10
11
12
A
B
C
D
EF
G
H
I
J
K
L
1, 2, 100, 1090
Not changeable
TRUE or FALSE
AND, OR, NOT
< = >
1.2, ,
One by one in linear
Can be changed
+, -, x
Name, address
Different position
DD MM YY
8/4/2019 Basic Element
47/49
EXCELENT!!!
GOOD JOB.
8/4/2019 Basic Element
48/49
`
End of Lesson
TEACHERis just giving the
information, butWHOwillachieve the excellent of life ???
... INCREASE YOUREFFORT
Dr. Fadhilah Kamsah
8/4/2019 Basic Element
49/49
THANK YOU!!!!