Project in TLE


Published on

Report of Group 4 of III-GOLD in TSHS for the second quarter of TLE.

Published in: Education, Technology
1 Like
  • Be the first to comment

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

No notes for slide

Project in TLE

  1. 1. <ul><li>3. Avoid using confusing letters or numbers such as zero and the letter O </li></ul><ul><li>Examples: One_0, Ph0ne_Num </li></ul><ul><li>4. Use underscore (_) in replacement of a space </li></ul><ul><li>Examples: Class_Num, Birth_date </li></ul><ul><li>5. Lessen the number of character of your variable. The shorter the better. </li></ul><ul><li>Examples: Int_Flight, Loc_Flight.Lbl1 </li></ul><ul><li>6. In most cases, upper and lowercases are read differently. A and a may hold different data </li></ul><ul><li>Example: B,b </li></ul>
  2. 3. LEARNING OBJECTIVES <ul><li>After the report the students should be able to: </li></ul><ul><ul><li>Define what constants are </li></ul></ul><ul><ul><li>Explain the meaning and use of operators </li></ul></ul><ul><ul><li>Learn and evaluate arithmetic operators properly </li></ul></ul><ul><ul><li>Learn and use relational opeartors </li></ul></ul><ul><ul><li>Define and use logical operators </li></ul></ul>
  3. 5. CONSTANTS <ul><li>Constants are values that do not change during the execution of the program. </li></ul><ul><li>Example: </li></ul><ul><li>Pi=3.1416 </li></ul><ul><li>X=100 </li></ul>
  4. 7. OPERATORS <ul><li>An operator is a symbol or a character indicating an operation that acts on one or more elements. These elements are refered to as operands </li></ul>
  5. 8. OPERANDS <ul><li>An operand is the object of a mathematical operation or a computer instruction. The number of operands depends on the programming language you use. </li></ul><ul><li>For Example: </li></ul><ul><li>Pascal Programming Language contains constants, data, variables, and other arithmetic expressions . </li></ul>
  6. 9. CLASSIFICATION of OPERATORS <ul><li>Arithmetic Operators </li></ul><ul><li>Logical Operators </li></ul><ul><li>Relational Operators </li></ul><ul><li>Assignment Operators </li></ul>
  7. 10. Arithmetic Operators <ul><li>They are operators that perform mathematical operations or calculations </li></ul><ul><li>It can involve two or more numeric arguments (operands) </li></ul><ul><li>These operators are similar to what the 4 fundamental operations </li></ul>
  8. 11. FUNCTION OPERATOR Addition + (plus sign) Subtraction - (minus sign) Multiplication * (asterisk) Division / (slash) Modular Division/ Modulus mod Integer Division div Exponentiation ^ (caret sign) Negation - (minus sign)
  9. 12. + and - <ul><li>+ operators are just the same as addition in real life as well as subtraction </li></ul><ul><li>Example: </li></ul><ul><li>25 + 25 = 50 </li></ul><ul><li>69 + 1 = 70 </li></ul><ul><li>50 +70 = 120 </li></ul><ul><li>- operators are just the same with the real life subtraction </li></ul><ul><li>Example: </li></ul><ul><li>75-5 = 70 </li></ul><ul><li>100-50=50 </li></ul><ul><li>70-50= 20 </li></ul>
  10. 13. * and / <ul><li>Just like the addition and subtraction operational principle; multiplication is just the same </li></ul><ul><li>Example: </li></ul><ul><li>3*9 = 27 </li></ul><ul><li>9*9 = 81 </li></ul><ul><li>Just like the addition and subtraction operational principle division is just the same </li></ul><ul><li>Example: </li></ul><ul><li>25/5 = 5 </li></ul><ul><li>81/9 = 9 </li></ul>
  11. 14. Div <ul><li>It computes ONLY the integral part of the result of dividing its first operand to its second operand </li></ul><ul><li>An integral part is defined as an integer or whole number such as 1, 10, or 5 </li></ul>2 7 2 3.5 1 7 div 2
  12. 15. Mod <ul><li>Modulus returns the integer remainder of a division. </li></ul><ul><li>Examples: </li></ul><ul><li>7 mod 2 Result:1 </li></ul><ul><li>6 mod 2 Result:0 </li></ul>2 7 2 3 1 7 div 2 7 mod 2
  13. 16. ^ and - <ul><li>Exponentiation is self explanatory. It only means that a number can be expressed with an exponents </li></ul><ul><li>Example: </li></ul><ul><li>4^5 </li></ul><ul><li>6^23 </li></ul><ul><li>Negation makes a number in its negative form </li></ul><ul><li>Example: </li></ul><ul><li>- (5) = -5 </li></ul><ul><li>- (43) = -43 </li></ul>
  14. 17. HEIRARCHY of ARITHMETIC OPERATIONS <ul><li>It is also called OPERATOR PRECEDENCE. It refers to the priority of the various operators when more than one is used in an expression. Parenthesis are used as the need arises. </li></ul>
  15. 18. EXPRESSION <ul><li>Expression in programming, is a combination of symbols, identifiers, values and operators that yield a result upon evaluation </li></ul>
  16. 19. NEMDASMo Method <ul><li>1 st : Negation </li></ul><ul><li>2 nd : Exponentiation </li></ul><ul><li>3 rd :Multiplication and Division </li></ul><ul><li>4 th : Addition and Subtraction </li></ul><ul><li>5 th : Modulus </li></ul>
  17. 20. Example: <ul><li>5+(4*2/2)-3=6 </li></ul><ul><li>5+(8/2)-3 </li></ul><ul><li>(5+4)-3 </li></ul><ul><li>9-3 </li></ul><ul><li>6 </li></ul>
  18. 21. LESSON TERMS <ul><li>Operator </li></ul><ul><li>Arithmetic Operator </li></ul><ul><li>Operand </li></ul><ul><li>Div </li></ul><ul><li>Mod </li></ul><ul><li>Integer </li></ul><ul><li>Expression </li></ul>
  19. 22. <ul><li>Write your answers in a one whole sheet of paper. Copy the given values and variables. </li></ul>
  20. 23. VALUES and VARIABLES <ul><li>A = 2 </li></ul><ul><li>B = 22 </li></ul><ul><li>C = 3 </li></ul><ul><li>D = 23 </li></ul><ul><li>E = 5 </li></ul><ul><li>F = 10 </li></ul><ul><li>G = 20 </li></ul><ul><li>H = 30 </li></ul>
  21. 24. <ul><li>H/C/(E-A) </li></ul><ul><li>F*H-G*E </li></ul><ul><li>D+A+C*E-G/F </li></ul><ul><li>A+B*3 </li></ul><ul><li>(H+G)/E </li></ul><ul><li>H+G/E </li></ul>
  23. 26. Assignment Operators <ul><li>Is used to assign values to variables. You can assign any type of data to a variable, real, integer, char and boolean. </li></ul><ul><li>The sign for assignment operator is := </li></ul>
  24. 27. Assignment Statements <ul><li>It always consist of a variable on the left hand side of an assignment operator, and an expression on a right side </li></ul><ul><li>The expression can be a variable, a number, or any complicated expression made up of variables, numbers and arithmetic operators </li></ul><ul><li>It instructs the computer to evaluate the expression and assign value of its result to the variable </li></ul><ul><li>Form: Variable := Expression </li></ul>
  25. 28. Illustrative Example <ul><li>PROD := N1 * N2 </li></ul>VARIABLE EXPRESSION ASSIGNMENT OPERATOR
  26. 29. <ul><li>This statement would assign the product of the expression N1*N2 to the variable PROD. Since the value of a variable can be changed during the program execution, the value of the variable PROD could also change depending on the value stored in any of the two variables N1 and N2 </li></ul>
  27. 30. Example <ul><li>NUM1 := 15; </li></ul><ul><li>FirstLetter := ‘A’; </li></ul><ul><li>X := 6; </li></ul><ul><li>Y := X; </li></ul><ul><li>Z = Y + NUM1 </li></ul>
  28. 31. <ul><li>The number 6 there is assigned to the variable X, then in the fourth statement, the variable X is assigned to the variable Y </li></ul>
  29. 32. A variable on the right-hand side of an assignment statement must first be given a value before it can be used in an assignment statement. A variable without an assigned value is called an uninitialized variable
  30. 33. Relational Operators <ul><li>Operators that are used to compare two values basing on certain conditions. </li></ul><ul><li>yield a true or false result </li></ul><ul><li>Form: value | relational operator | value </li></ul><ul><li>The operands of a relational operator must be of the same data type, or one maybe type real and the other type integer </li></ul>
  31. 34. FUNCTION OPERATOR Greater than > Less than < Equal to = Not equal to <> Greater than or Equal to >= Less than or Equal to <=
  32. 35. EXAMPLE RESULT 8>5 True 8<5 False What happened in here was a type mismatch 8=8 True 8<>5 True 8>=10 False What happened here was a type mismatch 8<=9 True
  33. 36. <ul><li>Relational operators ALWAYS result to Boolean Values (true or false). There are only two possible values for relational operators and this can only be either the value TRUE, and value FALSE </li></ul>
  34. 37. LESSON TERMS <ul><li>Assignment Operator </li></ul><ul><li>Assignment Statement </li></ul><ul><li>Relational Operators </li></ul><ul><li>Boolean Values </li></ul>
  35. 38. In your notebook
  36. 40. Write the correct statement for the following values to the given variables <ul><li>Assign the value 250 to DailyRate </li></ul><ul><li>Assign the product of 100 and 200 to the variable Product </li></ul><ul><li>Assign the value of X to MyValue </li></ul><ul><li>Assign the total of the product of X and Y and W and Z to Total </li></ul><ul><li>Assign the value of Total (No.4) to the values of ExtremeTotality </li></ul>
  37. 41. Determine the Boolean Value <ul><li>If A = 100 </li></ul><ul><li>If B = 200 </li></ul><ul><li>If C = 300 </li></ul><ul><li>If D = 400 </li></ul><ul><li>If E = 500 </li></ul><ul><li>(B*C) > (C*B) </li></ul><ul><li>((A*C)+D) = ((A*D)+C) </li></ul><ul><li>E < 500 </li></ul><ul><li>A + D <= E </li></ul><ul><li>(A + B + C + D + E) >= 15000 </li></ul>
  38. 42. PLEASE EXCHANGE NOTEBOOKS to YOUR CHEATMATES <ul><li>DailyRate := 250 </li></ul><ul><li>100*200 := Product </li></ul><ul><li>MyValue := X </li></ul><ul><li>X*Y*W*Z := Total </li></ul><ul><li>X*Y*W*Z := Total := ExtremeTotality or Total := ExtremeTotality </li></ul>
  39. 43. PLEASE EXCHANGE NOTEBOOKS to YOUR CHEATMATES <ul><li>(60,000) > (60, 000) FALSE </li></ul><ul><li>30,400 = 40,300 FALSE </li></ul><ul><li>500 < 500 FALSE </li></ul><ul><li>500 <= 500 TRUE </li></ul><ul><li>1500 >= 15000 FALSE </li></ul>
  40. 44. Logical Operators <ul><li>They are also called as Boolean Operators </li></ul><ul><li>Boolean operators are operators that evaluate expressions and determine whether the conditions specified by the expressions are either true or false </li></ul><ul><li>Requires boolean operators </li></ul>
  41. 45. KINDS OF BOOLEAN OPERATOR <ul><li>The AND Operator </li></ul><ul><li>The OR Operator </li></ul><ul><li>The NOT Operator </li></ul>
  42. 46. The AND Operator <ul><li>The and operator evaluates to true , only if both its operands (or expressions) are true. </li></ul>
  43. 47. (X > 75) and (Y > 75)
  44. 48. <ul><li>If both expressions (X > 75) and (Y >75) include in the statement evaluate to true (if both X and Y values are greater than 75), then the above statement will evaluate to true , otherwise, the statement will evaluate to false . </li></ul>
  45. 49. AND Operator Operand / Expression 1 Operand/ Expression 2 Decision True True True True False False False True False False False False
  46. 50. ILLUSTRATIVE EXAMPLE <ul><li>TRUE - TRUE </li></ul><ul><li>TRUE - FALSE </li></ul><ul><li>(34 <> 23) </li></ul><ul><li>(12 <> 23) </li></ul><ul><li>True </li></ul><ul><li>(97 > 32) </li></ul><ul><li>(24 <> 24) </li></ul><ul><li>False </li></ul>
  47. 51. ILLUSTRATIVE EXAMPLE <ul><li>FALSE - TRUE </li></ul><ul><li>FALSE - FALSE </li></ul><ul><li>(12 <> 12) </li></ul><ul><li>(14 <= 23) </li></ul><ul><li>False </li></ul><ul><li>(23 <> 23) </li></ul><ul><li>(23 < 23) </li></ul><ul><li>False </li></ul>
  48. 52. The OR Operator <ul><li>The OR Operator determines whether one or both of its operands (or expressions) are true or false. </li></ul>
  49. 53. (X = 1) or (X = 3)
  50. 54. <ul><li>If one of the expressions in the statement is true, the statement evaluates to true . This means that if X is equal to either 1 or 3, then the statement is true. For example if, X=4 then the statement above returns the value false </li></ul>
  51. 55. OR Operator Operand / Expression 1 Operand/ Expression 2 Decision True True True True False True False True True False False False
  52. 56. ILLUSTRATIVE EXAMPLE <ul><li>TRUE - TRUE </li></ul><ul><li>TRUE - FALSE </li></ul><ul><li>(4=4) </li></ul><ul><li>(5=5) </li></ul><ul><li>True </li></ul><ul><li>(E=5) </li></ul><ul><li>(5 <>5) </li></ul><ul><li>True </li></ul>
  53. 57. ILLUSTRATIVE EXAMPLE <ul><li>FALSE- TRUE </li></ul><ul><li>FALSE-FALSE </li></ul><ul><li>(45>56) </li></ul><ul><li>(12 <> 23) </li></ul><ul><li>True </li></ul><ul><li>(9 >= 32) </li></ul><ul><li>(24 <> 24) </li></ul><ul><li>False </li></ul>
  54. 58. The NOT Operator <ul><li>The NOT Operator has a single operand which it evaluates to either true or false. </li></ul><ul><li>It returns the opposite of the value returned by the variable </li></ul>
  55. 59. If passed is true, then not passed is false If passed is false, then not passed is true
  56. 60. NOT Operator Operand / Expression 1 Operand / Expression 2 Operand / Expression 1 Decision Operand / Expression 2 Decision True True False False True False False True False True True False False False True True
  57. 61. OPERATOR PRECEDENCE OPERATOR PRECEDENCE Not *, /, div, mod, and + , -, or <, <=, =, <>, >=, > Highest (evaluated first) Lowest (evaluated last)
  58. 62. LESSON TERMS <ul><li>Boolean Operator </li></ul><ul><li>And </li></ul><ul><li>Or </li></ul><ul><li>Not </li></ul><ul><li>Operator Precedence </li></ul>
  59. 63. In your notebook
  60. 64. Determine the Boolean values returned by the following operators with the given values <ul><li>X: 100 </li></ul><ul><li>Y: 50 </li></ul><ul><li>A: 200 </li></ul><ul><li>B: 75 </li></ul><ul><li>Condition: true </li></ul><ul><li>Flag: false </li></ul><ul><li>(X>105) or (B>50) </li></ul><ul><li>(X=75) and (X>75) </li></ul><ul><li>(A<>B) or (X = Y) </li></ul><ul><li>(not condition) and (not flag) </li></ul><ul><li>Not flag </li></ul><ul><li>((X*2)=200) and (X=100) </li></ul><ul><li>(X<75) or (Y<75) </li></ul><ul><li>((A+B)>250) or ((X+Y)>150) </li></ul><ul><li>(not condition) </li></ul><ul><li>(B<50) and (A=200) </li></ul>
  61. 65. <ul><li>Answers: </li></ul><ul><li>True </li></ul><ul><li>False </li></ul><ul><li>True </li></ul><ul><li>False </li></ul><ul><li>True </li></ul><ul><li>True </li></ul><ul><li>True </li></ul><ul><li>True </li></ul><ul><li>False </li></ul><ul><li>False </li></ul>
  62. 66. GET THE TOTAL NUMBER of SCORE Number Topic Items 1 Arithmetic Operators 5 2 A Assignment Operators 5 2 B Relational Operators 5 3 Boolean/ Logical Operators 10 25
  63. 67. By Group 4