Professional Documents
Culture Documents
Basic Element
Basic Element
Basic Element
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 and selection control structure.
&
DEFINITION
CONSTANTS Constant is a virtual data container that stores information. The value will never change (remains constant) at any time during the course of a program. VARIABLES Variables is a virtual data container that stores information. The value inside may change at any time during the course of a program
const pi = 3.142
const MARGIN = 10
CONCLUSION
CONSTANT Characteristics Value is not changeable during the course of the program Usage Use constants when you want to declare something that wont be changed midway in your program execution VARIABLES Value can be change anytime during the course of the program Use variables to store data that may or will change during the running of the program
ACTIVITY
CONSTANTS VS VARIABLES
________________ ____________ Value is ________________ during the course of the program ________________ Value ________________ anytime during the course of the program ____________ Use constants when Use variables to store you want to declare data that something that ________________ ________________ during the running midway in your of the program program execution
DATA TYPES
?
?
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
Data types determines the type of data a variable can store, for example a number or a character
INTEGER
MAIN
DOUBLE
Any number value that may contain a fractional part or decimal point
Example :
1.2,
,
MAIN
STRING
MAIN
www.themegallery.com
BOOLEAN
Boolean provide two value either TRUE or FALSE Programmers usually use it to store status Example : If (marks40) TRUE score = PASS; else FALSE MAIN score = FAIL
DATE
Example :
DD/MM/YY -> Date/Month/Year 26/01/09
NEXT
TYPE OF DATA
DEFINITION Any number that contain whole number that does not have fractional part Any number value that maybe contain a fractional part or decimal point Non-numerical that contain a sequence of characters value either TRUE or FALSE
EXAMPLE
DATE
DD/MM/YY
www.themegallery.com
CONCLUSION
STANDARD DATA TYPES
INTEGER
DOUBLE
STRING
BOOLEAN
DATE
www.themegallery.com
ACTIVITY
1. There are several labels here.
2. I need volunteers to take the labels and paste them on the mahjong paper
www.themegallery.com
Operator is a symbol or notation that tells a computer to perform certain actions or operations. Lets look at some examples of Mathematical Operators
DIFFERENCES
Mathematical operators Relational operators perform element-byperform mathematical element comparisons operations such as plus between two or substract. arrays.
Logical operators perform logical operations such as checking the condition of two Boolean values.
Activity 3
Instruction: Choose and click the correct answer.
1.
Operator is a program or software that tells the computer to perform certain actions or operations.
TRUE FALSE
2. An example of a logical operator is the plus (+) operation which will tell the computer to perform the add operation.
TRUE FALSE
3. Mathematical operators tell the computer to perform mathematical operations that are similar to operators in mathematics.
TRUE FALSE
5. Mathematical operators perform logical operations such as checking the condition of two Boolean values.
TRUE FALSE
HOME
NEXT
HOME
CONTROL STRUCTURE
Structure of statements in programming that allows the programmer to control the flow of a program.
ACTIVITY
1. _______________ refers to the linear execution of codes within a program. Its statements are executed one by one in consecutive order.
Sequence Control Selection Control
2. _____________enables the programmer to assign different events for different situations. Programmers can use it to implement decision making process within its program.
Sequence Control Selection Control
3. Control structure is a method or technique that allows the programmer to control the flow of a program.
True False
EXCELENT!!!
GOOD JOB.
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
QUIZ - Match
Constants 1 A B C D E F G H I J K L
Variables
Integer Double
2
3 4 5 6
1, 2, 100, 1090
String
Boolean Date Mathematical operators Relational operators Logical operators Sequence Control Structure Selection Control Structure
7
8 9
10 11
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
12
EXCELENT!!!
GOOD JOB.
TEACHER is just giving the information, but WHO will achieve the excellent of life ??? ` ... INCREASE YOUR EFFORT
Dr. Fadhilah Kamsah
End of Lesson
THANK YOU!!!!