la5 basicelement
DESCRIPTION
TRANSCRIPT
04/09/23 Shima Mohd 1
Basic Element1 – Constant
2 – Variable
3- Data Type
In programming
4 – Operator
5 – Control Structure
Prepared by : Norhasimah Mohamed – ICt Teacheri SMK Sungai Pusu Gombak Selangor. 12042008
04/09/23 Shima Mohd 2
Basic Element In Programming
Learning Outcomes
5.1.5.1 Differentiate between constants and variables
5.1.5.2 Differentiate between data types: Boolean, integer, double, string and
date.
5.1.5.3 Differentiate between mathematical and logical (Boolean) operators.
5.1.5.4 Differentiate between sequence control structure and selection control
structure.
04/09/23 Shima Mohd 3
Basic element in programming51 2 3 4 5
04/09/23 Shima Mohd 4
Basic Element In Programming
CONSTANTS AND VARIABLES
Constants– Constant is a data container that stores information. – The value that do not change during program execution.– They can be of type integer, character or floating-point.– Example: Const n As Integer = 10
Variables– Variable is a data container that stores information. – The value inside may change at any time during the course of a program.– When create variables, the declaration gives them a symbolic name and
definition reserves memory for them.– Once defined, variable are used to hold the data that required by program
from its operation. – Example: Dim mark as integer
04/09/23 Shima Mohd 5
Basic Element In Programming
CONSTANTS AND VARIABLES
04/09/23 Shima Mohd 6
Differences between constants and variables
04/09/23 Shima Mohd 7
Basic Element In Programming
DATA TYPES, OPERATOR AND CONTROL STRUCTURES
04/09/23 Shima Mohd 8
Basic Element In Programming
DATA EXAMPLES FOR DIFFERENT DATA TYPES
• Data type determines the type of data a variable can store, for example a number or a character.
• Examples of data types are integer, double, string, date and boolean.
04/09/23 Shima Mohd 9
Basic Element In Programming
MATHEMATICAL, RELATIONAL AND LOGICAL OPERATORS
• Operator is a symbol or notation that tells a computer to perform certain actions or operations.
• An example: the plus (+) notation will tell the computer to perform the "add" operation.
04/09/23 Shima Mohd 10
Basic Element In Programming
MATHEMATICAL, RELATIONAL AND LOGICAL OPERATORS
• Let's look at some examples of Mathematical Operators.
04/09/23 Shima Mohd 11
Basic Element In Programming
MATHEMATICAL, RELATIONAL AND LOGICAL OPERATORS
• Let's look at some examples of Relational Operators.
04/09/23 Shima Mohd 12
Basic Element In Programming
MATHEMATICAL, RELATIONAL AND LOGICAL OPERATORS
• Let's look at some examples of Logical Operators.
04/09/23 Shima Mohd 13
Differences in mathematical and logical operator
Mathematical operators perform mathematical operations such as plus or substract.
Relational operators perform element-by-element comparisons between two arrays.
Logical operators perform logical operations such as checking the condition of two Boolean values.
04/09/23 Shima Mohd 14
Control Structure
• Control structure is a structure of statements in programming that allows the programmer to control the flow of a program.
• Control structure can be divided into sequence, selection and repetition control structures.
04/09/23 Shima Mohd 15
Control Structure
SEQUENCE CONTROL
• Sequence control refers to the linear execution of codes within a program.
• In sequence control, the statements are executed one by one in consecutive order.
04/09/23 Shima Mohd 16
Control Structure SELECTION CONTROL
• There are times when you want your program to make a decision based on the situation given.
• For example, a program that stores student’s marks may respond differently to different marks. Or maybe a simple mathematical program will display its result as odd or even, based on the result.
• Selection control enables the programmer to assign different events for different situations.
• An example of selection control is “If...Then...Else” statement.
04/09/23 Shima Mohd 17
Differences between sequence and selection control
04/09/23 Shima Mohd 18
PSEUDO CODES• Pseudo code is text only sentences
that describe the logic and program flow of a computer program. Pseudo code esembles plain English.
• It usually does not have any specific programming language syntax and grammar.
• Pseudo code is directly linked to the computer codes because each pseudo code statement can often be converted into the programming language virtually line by line.
• There are no set rules for writing pseudo code.
• A programmer can have his or her personalised pseudo code.
• He or she must use consistent language and syntax in the pseudo code, so that he or she can understand it at a later stage.
04/09/23 Shima Mohd 19
FLOW CHART• A flow chart is a diagram using symbols
to show the step-by-step sequence of procedures in a program. A flow chart describes the logic and program flow of a computer program graphically.
• We have five main elements in a flow chart.
• Terminator shows the beginning or end of a program.
• Flowline and arrowhead use to connect symbols and indicate the sequences of operation.
• Input or output shows either an input operation (e.g. an INPUT from the user) or an output operation (e.g. PRINT some messages).
• Process shows a process to be carried out (e.g. calculation).
• Decision shows a decision (or choice) to be made. The program should continue along one of two routes (e.g. if...else).
1
23
4
5
04/09/23 Shima Mohd 20
Complete the handout givenTask for today
04/09/23 Shima Mohd 21
It’s not about a technology…
it’s about people!
‘Educating the -Generation’ e
04/09/23 Shima Mohd 22
It’s not about a technology…
it’s about learning!
‘Educating the -Generation’ e
04/09/23 Shima Mohd 23
Don’t start with technology,but learning via
technology.
‘Educating the -Generation’ e
04/09/23 Shima Mohd 24
see
04/09/23 Shima Mohd 25
Thank you
Prepared by : Norhasimah Mohamed –ICT Teacher SMK Sungai Pusu Gombak Selangor.