La5 Basicelement


Published on

Published in: Technology, Education
1 Comment
  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

La5 Basicelement

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