Flow Charting Damian Gordon. Introduction We mentioned it already, that if we thing of an analyst as being analogous to an architect, and a developer.

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

Introduction to Flowcharting
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Reference :Understanding Computers
Lab #6 Program Design.
Prime Numbers and Prime Factorization
Prime Numbers and Prime Factorization
Prime Numbers and Prime Factorization. Factors Factors are the numbers you multiply together to get a product. For example, the product 24 has several.
4.2 Factors and Divisibility
Section 5.1 Prime Factorization and Greatest Common Factor.
8.1 Monomials and Factoring Objective Students will be able to: 1. find the prime factorization of a monomial. 2. find the greatest common factor (GCF)
Tutorial #6 PseudoCode (reprise)
5 Minute Check Complete in your notebook.
Definition of a Prime Number
PRIME FACTORIZATION.
Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.
Flow Charting, Structured English and PseudoCode
Tutorial #7 Flowcharts (reprise) Program Design. Introduction We mentioned it already, that if we thing of an analyst as being analogous to an architect,
Developing logic (Examples on algorithm and flowchart)
Flow Charts. Thinking Creatively Flow Charts START END Is A==6? No A = 1 Yes Print A A = A + 1.
(BASIC MATH) QUIZ. START!! Click Here!! 1. What is Addition? a. The act or process of adding numbers. The act or process of adding numbers. b. The act.
Factors Terminology: 3  4 =12
division algorithm Before we study divisibility, we must remember the division algorithm. r dividend = (divisor ⋅ quotient) + remainder.
Solving a System of Equations using Multiplication
CSC103: Introduction to Computer and Programming
Some Properties of Whole Numbers and their Operations
Flowcharting An Introduction
Selection: IF Statement Damian Gordon. adsdfsdsdsfsdfs dsdlkmfsdfmsdl kfsdmkfsldfmsk dddfsdsdfsd.
Prime Numbers and Prime Factorization. Factors Factors are the numbers you multiply together to get a product. For example, the product 24 has several.
Objectives The student will be able to: 7A: Find the prime factorization of a number, the greatest common factor (GCF) for a set of monomials and polynomials.
Ch 1.3 – Order of Operations
Iteration: WHILE Loop Damian Gordon. WHILE Loop Consider the problem of searching for an entry in a phone book with only SELECTION:
4.8b SKM & PP 1 Division of Polynomials. 4.8b SKM & PP 2 Division of Polynomials First, let’s review the symbols that represent the division problem:
2.1 The Addition Property of Equality
Mixed Numbers to Improper Fractions. Lets say you have a mixed number of 1 and 5/8 You can change this into the number 13/8. For converting mixed numbers.
Prime Factorization. Prime Numbers A Prime Number is a whole number, greater than 1, that can be evenly divided only by 1 or itself.
Prime Numbers and Prime Factorization. Factors Factors are the numbers you multiply together to get a product. For example, the product 24 has several.
Prime Numbers & Prime Factorization. Factors Factors are the numbers you multiply together to get a product. For example, the product 24 has several factors.
One-Step Equations I can show that solving an equation leads to finding the value that makes the equation true.
Rules to Remember When solving an equation, the goal is to get the variable by itself. Addition and Subtraction are inverse operations. (opposites) Multiplication.
Drill #4 Evaluate the following if a = -2 and b = ½. 1. ab – | a – b | Solve the following absolute value equalities: 2. |2x – 3| = |5 – x | + 4.
Ch 1.2 Objective: To simplify expressions using the order of operations.
Divisibility Tests How can you tell quickly whether a number can be divided exactly by another?
Prime Numbers Damian Gordon. Prime Numbers So let’s say we want to express the following algorithm: – Read in a number and check if it’s a prime number.
Expression or Equation? 3x + 7 4y – 10 = 54 5z + 32 = 47 6x + 2y (8x – 1) 2 + y 2x = 16.
1 Introduction to Flowcharting Computer Science Principles ASFA.
Prime and Composite Numbers A prime number is a natural number greater than 1 whose only factors are 1 and itself. The first few prime numbers are 2,
Prime Numbers and Prime Factorization
Prime Numbers and Prime Factorization
3x + 2 6x3 - 5x2 – 12x – 4 2x2 – 3x – 2 6x3 + 4x2 -9x2 – 12x -9x2 – 6x
ALGORITHMS AND FLOWCHARTS
Finding GCF SOL A.2c.
Prime Numbers and Prime Factorization
Prime Numbers.
Exercise 24 ÷ 2 12.
Prime Numbers and Prime Factorization
Review Basic Math Divisibility tests Prime and Composite Numbers
Structured Program Design
Prime Numbers and Prime Factorization
Python: Algorithms Damian Gordon.
Prime Numbers and Prime Factorization
Some Simple Tips and Reminders
Prime Numbers and Prime Factorization
Multiply and divide Expressions
Objectives The student will be able to:
Prime Factorization FACTOR TREE.
Prime Numbers and Prime Factorization
Finding GCF SOL A.2c.
Prime Numbers and Prime Factorization
Presentation transcript:

Flow Charting Damian Gordon

Introduction We mentioned it already, that if we thing of an analyst as being analogous to an architect, and a developer as being analogous to a builder, then the most important thing we can do as analysts is to explain our designs to the developers in a simple and clear way. How do architects do this?

Flowcharts So let’s say we want to express the following algorithm: – Read in a number and print it out.

START

Read in A

START Read in A Print A

START END Read in A Print A

Flowcharts So let’s say we want to express the following algorithm: – Read in a number and print it out double the number.

START

Read in A

START Read in A Print A*2

START END Read in A Print A*2

Or alternatively...

START

Read in A

START Read in A B = A*2

START Read in A B = A * 2 can be read as “B gets the value of A multiplied by 2” B = A*2

START Read in A Print B B = A*2

START END Read in A Print B B = A*2

Flowcharts So let’s say we want to express the following algorithm: – Read in a number, check if it is odd or even.

START

Read in A

START Does A/2 give a remainder? Read in A

START Does A/2 give a remainder? Read in A Yes Print “It’s Odd”

START Does A/2 give a remainder? No Read in A Yes Print “It’s Odd”Print “It’s Even”

START END Does A/2 give a remainder? No Read in A Yes Print “It’s Odd”Print “It’s Even”

Flowcharts So let’s say we want to express the following algorithm to print out the bigger of two numbers: – Read in two numbers, call them A and B. Is A is bigger than B, print out A, otherwise print out B.

START

Read in A and B

START A>B? Read in A and B

START A>B? Read in A and B Yes Print A

START A>B? No Read in A and B Yes Print APrint B

START END A>B? No Read in A and B Yes Print APrint B

Flowcharts So let’s say we want to express the following algorithm to print out the bigger of three numbers: – Read in three numbers, call them A, B and C. If A is bigger than B, then if A is bigger than C, print out A, otherwise print out C. If B is bigger than A, then if B is bigger than C, print out B, otherwise print out C.

START

Read in A, B and C

START A>B? Read in A, B and C

START A>B? Read in A, B and C Yes A>C?

START A>B? No Read in A, B and C Yes A>C?B>C?

START A>B? No Read in A, B and C Yes A>C?B>C? Print C No

START A>B? No Read in A, B and C Yes A>C?B>C? Print APrint C Yes No

START A>B? No Read in A, B and C Yes A>C?B>C? Print APrint CPrint B Yes No

START END A>B? No Read in A, B and C Yes A>C?B>C? Print APrint CPrint B Yes No

Flowcharts So let’s say we want to express the following algorithm: – Print out the numbers from 1 to 5

START

Print 1

START Print 1 Print 2

START Print 1 Print 2 Print 3

START Print 1 Print 2 Print 3 Print 4

START Print 1 Print 2 Print 3 Print 4 Print 5

START END Print 1 Print 2 Print 3 Print 4 Print 5

Or alternatively...

Flowcharts If I say A = A + 1, that means “A gets the value of whatever is in itself, plus 1” If A is 14 It becomes 15 A (new) 15 A (old) A = A + 1

START

A = 1

START Is A==6? A = 1

START Is A==6? No A = 1 Print A

START Is A==6? No A = 1 Print A A = A + 1

START Is A==6? No A = 1 Print A A = A + 1

START END Is A==6? No A = 1 Yes Print A A = A + 1

Flowcharts So let’s say we want to express the following algorithm: – Add up the numbers 1 to 5

Flowcharts But first a few points; If I say T = 5, that means “T gets the value 5” T = 5

Flowcharts But first a few points; If I say T = 5, that means “T gets the value 5” T T = 5

Flowcharts But first a few points; If I say T = 5, that means “T gets the value 5” T 5 T = 5

Flowcharts If I say T = X, that means “T gets the value of whatever is in the variable X” T = X

Flowcharts If I say T = X, that means “T gets the value of whatever is in the variable X” So if X is 14, then T will get the value 14. T = X

Flowcharts If I say T = X, that means “T gets the value of whatever is in the variable X” So if X is 14, then T will get the value 14. T X 14 T = X

Flowcharts If I say T = X+1, that means “T gets the value of whatever is in the variable X plus one” T = X + 1

Flowcharts If I say T = X+1, that means “T gets the value of whatever is in the variable X plus one” So if X is 14, T becomes 15, and X stays as 14. T = X + 1

Flowcharts If I say T = X+1, that means “T gets the value of whatever is in the variable X plus one” So if X is 14, T becomes 15, and X stays as 14. T X T = X + 1

Flowcharts If I say T = T + X, that means “T gets the value of whatever is in itself plus whatever is in the variable X” T = T + X

Flowcharts If I say T = T + X, that means “T gets the value of whatever is in itself plus whatever is in the variable X” If T is 14 and X is 9 T becomes 23 X stays at 9 T = T + X

Flowcharts If I say T = T + X, that means “T gets the value of whatever is in itself plus whatever is in the variable X” If T is 14 and X is 9 T becomes 23 X stays at 9 T (new) X 23 9 T (old) 14 T = T + X

Flowcharts So let’s say we want to express the following algorithm: – Add up the numbers 1 to 5

START

Total = 0

START A = 1 Total = 0

START Is A==6? A = 1 Total = 0

START Is A==6? No A = 1 Total = Total + A; Total = 0

START Is A==6? No A = 1 Total = Total + A; A = A + 1 Total = 0

START END Is A==6? No A = 1 Yes Total = Total + A; A = A + 1 Total = 0

Flowcharts So let’s say we want to express the following algorithm: – Read in a number and check if it’s a prime number.

Flowcharts So let’s say we want to express the following algorithm: – Read in a number and check if it’s a prime number. – What’s a prime number?

Flowcharts So let’s say we want to express the following algorithm: – Read in a number and check if it’s a prime number. – What’s a prime number? – A number that’s only divisible by itself and 1, e.g. 7.

Flowcharts So let’s say we want to express the following algorithm: – Read in a number and check if it’s a prime number. – What’s a prime number? – A number that’s only divisible by itself and 1, e.g. 7. – Or to put it another way, every number other than itself and 1 gives a remainder, e.g. For 7, if 6, 5, 4, 3, and 2 give a remainder then 7 is prime.

Flowcharts So let’s say we want to express the following algorithm: – Read in a number and check if it’s a prime number. – What’s a prime number? – A number that’s only divisible by itself and 1, e.g. 7. – Or to put it another way, every number other than itself and 1 gives a remainder, e.g. For 7, if 6, 5, 4, 3, and 2 give a remainder then 7 is prime. – So all we need to do is divide 7 by all numbers less than it but greater than one, and if any of them have no remainder, we know it’s not prime.

Flowcharts So, If the number is 7, as long as 6, 5, 4, 3, and 2 give a remainder, 7 is prime. If the number is 9, we know that 8, 7, 6, 5, and 4, all give remainders, but 3 does not give a remainder, it goes evenly into 9 so we can say 9 is not prime

Flowcharts So remember, – if the number is 7, as long as 6, 5, 4, 3, and 2 give a remainder, 7 is prime. So, in general, – if the number is A, as long as A-1, A-2, A-3, A- 4,... 2 give a remainder, A is prime.

START

Read in A

START Read in A B = A -1

START Read in A B = A -1 Is B = = 1?

START Read in A B = A -1 No Is B = = 1?

START Read in A B = A -1 No Is B = = 1? Does A/B give a remainder?

START Read in A B = A -1 No Is B = = 1? Yes Does A/B give a remainder?

START Read in A B = A -1 No B = B - 1 Is B = = 1? Yes Does A/B give a remainder?

START Read in A B = A -1 No B = B - 1 Is B = = 1? Yes Does A/B give a remainder?

START Read in A B = A -1 No B = B - 1 Is B = = 1? Yes Does A/B give a remainder? No Print “Not Prime”

START Yes Read in A Print “Prime” B = A -1 No B = B - 1 Is B = = 1? No Print “Not Prime” Yes Does A/B give a remainder?

START END Yes Read in A Print “Prime” B = A -1 No B = B - 1 Is B = = 1? No Print “Not Prime” Yes Does A/B give a remainder?

Symbols

Terminal Input/Output Operation Process Decision Connector Module Symbols