Programming Techniques

Slides:



Advertisements
Similar presentations
4.1 Friendly Numbers SRB 22.
Advertisements

Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
Addition Subtraction Multiplication Division
Integer Rules Adding Integers (+) + (+) = (+)  A positive plus a positive is positive. (-) + (-) = (-)  A negative plus a negative is negative.  (+)
ADDING, SUBTRACTING, MULTIPLYING AND DIVIDING INTEGERS By : Katie Kurth and Kateylnn Everhart.
Integers: Multiplication & Division
Adding Integers. Adding Integers with the Same Sign Add the absolute values. The sum will have the same sign as the addends. Example 1 Find –2 + (-3)
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
The Basic of Algebra BY Nathaniel Jefferson. The Number Line  |  0 Always start at zero.
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
2440: 211 Interactive Web Programming Expressions & Operators.
Addition, Subtraction, Multiplication, and Division of Integers
ORDER OF OPERATIONS x 2 Evaluate the following arithmetic expression: x 2 Each student interpreted the problem differently, resulting in.
Input, Output, and Processing
Flashback Without a calculator, find the answer. 1. (7 × 7 − 3 × 6) ÷ ( ) ÷ 9.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
22/11/ Selection If selection construct.
Cougar Time. Adding Negative Numbers  What are the two rules for adding integers?  Same Signs = Add and keep the sign  Different Signs = Find the absolute.
Subtracting Integers! By Zachary E. Hebrank.
8 th Grade Study Guide System of Equations - Pythagorean Theorem - Laws of Exponents Scientific Notation - Solving Equations.
CompSci Primitive Types  Primitive Types (base types)  Built-in data types; native to most hardware  Note: not objects (will use mostly first.
Doing math In java.
Addition Multiplication Subtraction Division. 1.If the signs are the same, add the numbers and keep the same sign = = If the.
INTEGER RULES. Adding Integers Adding IntegersRule # 1: Same Signs When adding integers with same signs, you add the numbers and write the common sign.
AOIT Introduction to Programming Unit 2, Lesson 6 Arithmetic Operators and Operator Precedence Copyright © 2009–2012 National Academy Foundation. All rights.
Data Handling in Algorithms. Activity 1 Starter Task: Quickly complete the sheet 5mins!
Lecture #8 Page 1 Lecture #8 Agenda 1.VHDL : Operators 2.VHDL : Signal Assignments Announcements 1.HW #4 assigned ECE 4110– Sequential Logic Design.
Ch 3.1 Add and Subtract Signed Numbers Vocabulary Op posites :2 numbers the same distance from 0 but in opposite directions
Adding Integers. Using Two Coloured Counters We can model integer addition with tiles. Represent -2 with the fewest number of tiles Represent +5 with.
7 - Programming 7J, K, L, M, N, O – Handling Data.
Introduction to Calculated Columns Variables, Conditionals, and String Manipulation PRESENTER: Cameron Blashka| Informer Implementation Specialist| April.
Math operations 9/19/16.
CMSC201 Computer Science I for Majors Lecture 03 – Operators
Chapter 2 Variables.
Topics Designing a Program Input, Processing, and Output
IGCSE 1 Cambridge Algorithms and flowcharts Unit 7 Computer Science
Thinking Mathematically
Warm-up Solve each equation 4+13= −3+7= 4−13= −3−7=
Operators Operators are symbols such as + (addition), - (subtraction), and * (multiplication). Operators do something with values. $foo = 25; $foo – 15;
Negative Numbers.
Chapter 7 Objectives Define basic terms in algebra: integer, number statement, expression, and coefficient Learn the relationships between positive and.
Please Excuse My Dear Aunt Sally
VB Math All of your favorite mathematical operators are available in VB: + Addition - Subtraction * Multiplication / Division \ Integer Division Mod Modulo.
Winter 2018 CISC101 11/22/2018 CISC101 Reminders
Integers (-3) + 5 = 2 (-9) + (-8) = -17 (-4) - (-9) = 5 (-2) – 10 =
Chapter 2 Variables.
CSI 101 Elements of Computing Spring 2009
Addition Subtraction Multiplication Division
If selection construct
More Maths Programming Guides.
If selection construct
Created by Mr. Lafferty Maths Dept.
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
VB Variables and Data
Operations Python code.
Data Types and Expressions
Boolean Expressions to Make Comparisons
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Fundamental OOP Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
Learning Intention I will learn about concatenation and arithmetic operators.
Python Math Operators.
In this class, we will cover:
Chapter 2 Variables.
Chapter 3: Selection Structures: Making Decisions
5.03 Apply operators and Boolean expressions
Data Types and Expressions
Section 9.3 Modular Arithmetic.
COMPUTING.
Data Types and Expressions
Presentation transcript:

Programming Techniques Keywords Arithmetic, Boolean, String, Concatenate (join), Substring, Delimiter, SPLIT, left, mid, right, Addition, Subtraction, Division, Modular division, Integer division, Negation, AND, OR, NOT, Greater than, Less than, Equal, Not equal, Modulus, Quotient, Exponentiation Programming Techniques Operators

Operators Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Once we have the information that we received from inputs or “hard-coded” (typed in when designing) in the program we need to manipulate this data – calculate, compare, etc. Operators represent the operations that are performed on the data. You already know operators in Maths, e.g. +, -, /, *, ^, etc. Starter activity

Questions Why do we need this? What is BODMAS? Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. What is BODMAS? Why is it important to know it? What does the following calculation give? (10 * 4) / 5 – 10 /1 * 0 = ??? Find out what operators you can use in python. Add a sentence and example of each one in use Why do we need this? Without operators and correct order for calculations, we can get in a mess! We need strict rules to ensure results are as intended. Operators cover a wide range of activities in programming. Starter activity

Operators in Use Objectives + Addition e.g. x = 6 + 5 gives 11 - BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Numbers: addition, subtraction, division, modular division (division with a remainder), integer division, multiplication, to-the-power-of, negation Boolean: AND, OR, NOT, larger, smaller, equal, not equal Strings/characters: slicing, length, format + Addition e.g. x = 6 + 5 gives 11 - Subtraction e.g. x = 6 - 5 gives 1 * Multiplication e.g. x = 12 * 2 gives 24 / Division e.g. x = 12 / 2 gives 6 MOD Modulus e.g. 12 MOD 5 gives 2 DIV Quotient e.g. 17 DIV 5 gives 3 ^ Exponentiation e.g. 3^4 gives 81 Starter activity

Operators in Use Logical operators – only used with Booleans Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity Logical operators – only used with Booleans AND - OR - NOT

Operators in Use Objectives Starter activity BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

MOD: Finding out Divisibility Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. We often have to break items into groups. (a) how many full football teams can be made from 53 pupils (b) how many pupils will be without a team? Division could be used to solve (a) ”Integer division” is division which ignores the remainder. 53 DIV 11 = 4 (b) can be solved through “modulus division”. Modulus gives the remainder left by diving one number with another 53 MOD 11 = 9, in other words 9 pupils would be without a team. Starter activity

String Operations Objectives Starter activity BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

String Operations (Pseudocode) Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

String Operations (Examples) Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

String Operations (Activity) Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Given these two variables: string A ="Great to see you!" string B="Britain to get showers overnight.” Use string operators and pseudocode to get the following strings: 1. "GREAT BRITAIN" 2. "TO SEE GREAT BRITAIN" Starter activity

Boolean Operators Objectives Starter activity BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

Boolean Example Objectives Starter activity BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

Answer Objectives Starter activity BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity