SME 1013 Programming for Engineers

Size: px
Start display at page:

Download "SME 1013 Programming for Engineers"

Transcription

1 SME 1013 Programming for Engineers Programming Concepts by: Mohamed Hussein compliments to: Assoc. Prof. Dr. Mohd Shafiek Yaacob Stages of Program Development Logic errors Input? Formula? Special Cases? Output? Step 1 Step 2 Branching? Looping? Stop? Fortran? C/C++? BASIC? Java? Syntax errors Devide by Zero? Formula? Special Cases? Output? Program Concept Algorithm Development Program Coding Debuging Experienced programmers spend up to 90% of their time working on the logic of their program, not on the coding 1

2 What are these? Building blocks of the game of TETRIS Building Blocks of a Program Sequential Executions - instructions are performed one after the other Branching Operations - a decision is made to perform one block of instructions or another. Looping Operations - a block of instructions is repeated Only these three basic building blocks are needed to develop a solution to a problem. 2

3 Some Definitions Algorithm - a step-by-step procedure for finding the solution to a problem. - the idea of how a problem can be solved. Pseudocode - a free way or style of how an algorithm is written. - a hybrid mixture of a particular programming language and English. Flowchart - a way to describe algorithms graphically. - requires correct use of symbols. Common Flowchart Symbols or stop computation Input or output subprocess direction of flow connection branching looping 3

4 Sequential Execution of Instructions Sequential instructions are executed one after the other. The computer begins with the first instruction. The result from current and previous calculations may be used in the subsequent calculation. The instructions must be executed in correct order. Example 1.1 Construct an algorithm and a flowchart to compute the weight w of a hollow sphere of outside diameter d, wall thickness t, and density ρ. 4

5 Solution 1.1 (Algorithm) 1. Compute the inner and outer radii r o = d/2 and r i = d/2 t 2. Compute the volume v = 4π(r o3 r i3 )/3 3. Compute the weight w = ρv Solution 1.1 (Flowchart) r o = d/2 r i = d/2 t v = 4π(r o3 r i3 )/3 w = ρv stop 5

6 Example 1.2 Construct an algorithm and a flowchart to compute the weight w of a hollow sphere of outside diameter d, wall thickness t, and density ρ. Allow for input of the values of diameter d, wall thickness t, and density ρ. Also, allow for output of the values of volume v and weight w. Solution 1.2 (Algorithm) 1. Input diameter, thickness, and density 2. Compute the inner and outer radii 3. Compute the volume 4. Compute the weight 5. volume and weight 6

7 Solution 1.2 Flowchart Input d, t, ρ r o = d/2 r i = d/2 t v = 4π(r o3 r i3 )/3 w = ρv v, w stop Branching Operations A branch is a point in the program where the computer will make a decision about which set of instructions to be executed next, A decision is made depending on the answer of a posed question. The question must be formulated such that it has a simple answer and has only one possible outcome (e.g. yes or no).? 7

8 Example 1.5 Construct an algorithm and a flowchart to determine if a point (x, y) lies within a circle of radius r centered at the origin. If the point lies within the circle, print out a message and the distance, z, of that point from the center of the circle. Solution 1.5 (Algorithm) 1. Input the radius r and the (x, y) coordinate 2. Compute the distance z = (x 2 + y 2 ) 1/2 of the point (x, y) from the origin. 3. Is z < r? If yes, then print inside and print z If no, then print outside End of branch 8

9 Solution 1.5 (Flowchart) Input r, x, y z = (x 2 + y 2 ) 1/2 yes inside, z z < r? no outside Stop Nesting Branching Operations A nested branch is used when the computer needs to choose between more than two alternatives.? Example 1.6 Construct a flowchart to see if an integer n is negative, positive, or zero.? 9

10 Solution 1.6 (Flowchart) Input n no n < 0? yes no n = 0? yes Negative Positive Zero Stop Loops A counted loop repeats the executions for a predetermine number of times. A conditional loop repeats the executions until a condition is satisfied. Instructions Count? Condition? yes no 10

11 Counted Loops Most widely used in computer programming. Loop control variable LCV is used to control the loop. The loop stops when the LCV exceeds stop value Number of iterations is predetermine finished value stop value step value body of loop LCV name loop back Example 1.8 Construct a flowchart to print out the numbers from 1 to 100 and their squares. 11

12 Solution 1.8 (Flowchart) =1 stop=100 step=1 LCV LCV, LCV 2 Stop Example 1.9 Construct a flowchart to print out the even numbers from 1 to 100 and their squares. 12

13 Solution 1.9 (Flowchart) =2 stop=100 step=2 LCV LCV, LCV 2 Stop Conditional Loops The most common type is termed the while loop. A set of instructions is repeated while some condition is true. yes Finished? no body of loop 13

14 Example 1.10 Construct a flowchart to read in a series of numbers and keep track of the running total and the number of data items. Stop reading in the numbers when one of them has a value of zero (sentinel value). Then compute the average of all the numbers and report it. Solution 1.10 (Flowchart) SUM=0 COUNT=0 Input X no AVG=SUM/COUNT X 0? yes SUM=SUM+X COUNT=COUNT+1 AVG, COUNT stop 14

15 Nested Loops A counted loop is placed within another counted loop or a combination of different loops within each other. Example 1.11 Construct an algorithm and flowchart to create a 10 by 10 multiplication table such as 1 x 1 = 1, 1 x 2 = 2, and so forth. Solution 1.11 (Flowchart) Stop =1 stop=10 step=1 LCV1 =1 stop=10 step=1 LCV2 Product = LCV1 x LCV2 LCV1, LCV2, Product 15

16 Procedures A large program is often broken into several smaller components known as procedures or modules. Modules or procedures may be reuse again in the same program or in another program. Subprocess Example 1/13 Construct a flowchart to read an integer and evaluate its factorial. Use the subprocess to calculate the factorial. n! = 1 x 2 x x (n-1) x n 16

17 Solution 1/13 (Flowchart) Input n Y=Factorial(n) n, Y Factorial Y = 1 =1 stop=n step=1 LCV Y = Y x LCV Stop Return 17

Section 7.2 Volume: The Disk Method

Section 7.2 Volume: The Disk Method Section 7. Volume: The Disk Method White Board Challenge Find the volume of the following cylinder: No Calculator 6 ft 1 ft V 3 1 108 339.9 ft 3 White Board Challenge Calculate the volume V of the solid

More information

Unit II. (i) Computer Programming Languages

Unit II. (i) Computer Programming Languages Unit II. (i) Computer Programming Languages Need of a computer programming language: A programming language is an artificial language designed to communicate instructions to a computer. Thousands of different

More information

REPETITION CONTROL STRUCTURE LOGO

REPETITION CONTROL STRUCTURE LOGO CSC 128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING REPETITION CONTROL STRUCTURE 1 Contents 1 Introduction 2 for loop 3 while loop 4 do while loop 2 Introduction It is used when a statement or a block of

More information

Nesting. Abstraction & Nesting. Example. if x is less than y output x is smaller else output y is smaller. CS256 Computer Science I Kevin Sahr, PhD

Nesting. Abstraction & Nesting. Example. if x is less than y output x is smaller else output y is smaller. CS256 Computer Science I Kevin Sahr, PhD CS256 Computer Science I Kevin Sahr, PhD Lecture 19: Nested Conditionals and Loops 1 Nesting remember that conditional statements and loops contain single statements (or single block statements) this statement

More information

SME1013 PROGRAMMING FOR ENGINEERS

SME1013 PROGRAMMING FOR ENGINEERS SME1013 PROGRAMMING FOR ENGINEERS Ainullotfi bin Abdul Latif Faculty of Mechanical Engineering UTM Problem Solving Recognise and understand the problem (what is it that needed to be solved?) List the parameters

More information

Repetition Structures

Repetition Structures Repetition Structures Chapter 5 Fall 2016, CSUS Introduction to Repetition Structures Chapter 5.1 1 Introduction to Repetition Structures A repetition structure causes a statement or set of statements

More information

Grades 7 & 8, Math Circles 20/21/22 February, D Geometry Solutions

Grades 7 & 8, Math Circles 20/21/22 February, D Geometry Solutions Faculty of Mathematics Waterloo, Ontario NL 3G1 Centre for Education in Mathematics and Computing D Geometry Review Grades 7 & 8, Math Circles 0/1/ February, 018 3D Geometry Solutions Two-dimensional shapes

More information

Loops / Repetition Statements

Loops / Repetition Statements Loops / Repetition Statements Repetition statements allow us to execute a statement multiple times Often they are referred to as loops C has three kinds of repetition statements: the while loop the for

More information

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution.

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution. Repetition Structures Introduction to Repetition Structures Chapter 5 Spring 2016, CSUS Chapter 5.1 Introduction to Repetition Structures The Problems with Duplicate Code A repetition structure causes

More information

Grades 7 & 8, Math Circles 20/21/22 February, D Geometry

Grades 7 & 8, Math Circles 20/21/22 February, D Geometry Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing 2D Geometry Review Grades 7 & 8, Math Circles 20/21/22 February, 2018 3D Geometry Two-dimensional shapes

More information

Dept. of CSE, IIT KGP

Dept. of CSE, IIT KGP Control Flow: Looping CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Types of Repeated Execution Loop: Group of

More information

SNS COLLEGE OF ENGINEERING,

SNS COLLEGE OF ENGINEERING, SNS COLLEGE OF ENGINEERING, COIMBATORE Department of Computer Science and Engineering QUESTION BANK(PART A) GE8151 - PROBLEM SOLVING AND PYTHON PROGRAMMING TWO MARKS UNIT-I 1. What is computer? Computers

More information

CS110D: PROGRAMMING LANGUAGE I

CS110D: PROGRAMMING LANGUAGE I CS110D: PROGRAMMING LANGUAGE I Computer Science department Lecture 5&6: Loops Lecture Contents Why loops?? While loops for loops do while loops Nested control structures Motivation Suppose that you need

More information

Information Science 1

Information Science 1 Topics covered Information Science 1 Fundamental Programming Constructs (1) Week 11 Terms and concepts from Week 10 Flow of control and conditional statements Selection structures if statement switch statement

More information

Loops (while and for)

Loops (while and for) Loops (while and for) CSE 1310 Introduction to Computers and Programming Alexandra Stefan 1 Motivation Was there any program we did (class or hw) where you wanted to repeat an action? 2 Motivation Name

More information

[Page 177 (continued)] a. if ( age >= 65 ); cout << "Age is greater than or equal to 65" << endl; else cout << "Age is less than 65 << endl";

[Page 177 (continued)] a. if ( age >= 65 ); cout << Age is greater than or equal to 65 << endl; else cout << Age is less than 65 << endl; Page 1 of 10 [Page 177 (continued)] Exercises 4.11 Identify and correct the error(s) in each of the following: a. if ( age >= 65 ); cout

More information

Chapter 5 Conditional and Iterative Statements. Statement are the instructions given to the computer to perform any kind of action.

Chapter 5 Conditional and Iterative Statements. Statement are the instructions given to the computer to perform any kind of action. Chapter 5 Conditional and Iterative Statements Statement Statement are the instructions given to the computer to perform any kind of action. Types of Statement 1. Empty Statement The which does nothing.

More information

Grade 9 Surface Area and Volume

Grade 9 Surface Area and Volume ID : ae-9-surface-area-and-volume [1] Grade 9 Surface Area and Volume For more such worksheets visit www.edugain.com Answer the questions (1) The radius of a cylinder is halved and the height is tripled.

More information

Chapter 4 Introduction to Control Statements

Chapter 4 Introduction to Control Statements Introduction to Control Statements Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives 2 How do you use the increment and decrement operators? What are the standard math methods?

More information

You will need the following items: scissors, plate, 5 different colored pencils, protractor, paper to answer questions

You will need the following items: scissors, plate, 5 different colored pencils, protractor, paper to answer questions Radian measure task You will need the following items: scissors, plate, 5 different colored pencils, protractor, paper to answer questions Instructions will follow on each slide. Feb 19 10:33 AM Step 1

More information

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 More Flow of Control Overview 3.1 Using Boolean Expressions 3.2 Multiway Branches 3.3 More about C++ Loop Statements 3.4 Designing Loops Slide 3-3 Flow Of Control Flow of control refers to the

More information

Grade 9 Surface Area and Volume

Grade 9 Surface Area and Volume ID : my-9-surface-area-and-volume [1] Grade 9 Surface Area and Volume For more such worksheets visit www.edugain.com Answer the questions (1) If the radii of two spheres are in ratio 5:2, find the ratio

More information

CN#7 Objectives. Vocabulary 5/23/ Spheres. I will learn and apply the formulas for the surface area and volume of a sphere.

CN#7 Objectives. Vocabulary 5/23/ Spheres. I will learn and apply the formulas for the surface area and volume of a sphere. Warm Up #9: The figure shows a hemisphere and a cylinder with a cone removed from its interior. The cross section of the hemisphere is a circle! with radius: r 2 x 2! so its area is:! A = π(r 2 x 2 ) CN#7

More information

Loops / Repetition Statements. There are three loop constructs in C. Example 2: Grade of several students. Example 1: Fixing Bad Keyboard Input

Loops / Repetition Statements. There are three loop constructs in C. Example 2: Grade of several students. Example 1: Fixing Bad Keyboard Input Loops / Repetition Statements Repetition s allow us to execute a multiple times Often they are referred to as loops C has three kinds of repetition s: the while loop the for loop the do loop The programmer

More information

Chapter 4: Control structures. Repetition

Chapter 4: Control structures. Repetition Chapter 4: Control structures Repetition Loop Statements After reading and studying this Section, student should be able to Implement repetition control in a program using while statements. Implement repetition

More information

Solving Problems Flow Control in C++ CS 16: Solving Problems with Computers I Lecture #3

Solving Problems Flow Control in C++ CS 16: Solving Problems with Computers I Lecture #3 Solving Problems Flow Control in C++ CS 16: Solving Problems with Computers I Lecture #3 Ziad Matni Dept. of Computer Science, UCSB A Word About Registration for CS16 FOR THOSE OF YOU NOT YET REGISTERED:

More information

Flowchart & Algorithm

Flowchart & Algorithm Flowchart & Algorithm 1 What is Algorithm? What is Flowchart? Write down the advantages and disadvantages. Compare them. Flowchart Flowchart is a pictorial or graphical representation of a process. Each

More information

CHAPTER 2 PROBLEM SOLVING TECHNIQUES. Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042

CHAPTER 2 PROBLEM SOLVING TECHNIQUES. Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042 CHAPTER 2 PROBLEM SOLVING TECHNIQUES Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042 Software Engineering vs Problem Solving Software Engineering - A branch of Computer Science & provides

More information

Notice that the height of each rectangle is and the width of each rectangle is.

Notice that the height of each rectangle is and the width of each rectangle is. Math 1410 Worksheet #40: Section 6.3 Name: In some cases, computing the volume of a solid of revolution with cross-sections can be difficult or even impossible. Is there another way to compute volumes

More information

Loops and Files. Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz

Loops and Files. Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Loops and Files Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Chapter Topics o The Increment and Decrement Operators o The while Loop o Shorthand Assignment Operators o The do-while

More information

To find the surface area and volume of a sphere

To find the surface area and volume of a sphere To find the surface area and volume of a sphere Sphere set of all points in space equidistant from a given point called the center. Surface Area Formula: S.A. = 4πr 2 r Volume Formula: V = 4 πr 3 3 Great

More information

EDEXCEL NATIONAL CERTIFICATE UNIT 4 MATHEMATICS FOR TECHNICIANS OUTCOME 1

EDEXCEL NATIONAL CERTIFICATE UNIT 4 MATHEMATICS FOR TECHNICIANS OUTCOME 1 EDEXCEL NATIONAL CERTIFICATE UNIT 4 MATHEMATICS FOR TECHNICIANS OUTCOME 1 TUTORIAL 4 AREAS AND VOLUMES Determine the fundamental algebraic laws and apply algebraic manipulation techniques to the solution

More information

Chapter Goals. Contents LOOPS

Chapter Goals. Contents LOOPS CHAPTER 4 LOOPS Slides by Donald W. Smith TechNeTrain.com Final Draft Oct 30, 2011 Chapter Goals To implement while, for, and do loops To hand-trace the execution of a program To become familiar with common

More information

Information Science 1

Information Science 1 Information Science 1 Fundamental Programming Constructs (1) Week 11 College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 10 l Flow of control

More information

Unit 1 Lesson 4. Introduction to Control Statements

Unit 1 Lesson 4. Introduction to Control Statements Unit 1 Lesson 4 Introduction to Control Statements Essential Question: How are control loops used to alter the execution flow of a program? Lesson 4: Introduction to Control Statements Objectives: Use

More information

Chapter 4: Control structures

Chapter 4: Control structures Chapter 4: Control structures Repetition Loop Statements After reading and studying this Section, student should be able to Implement repetition control in a program using while statements. Implement repetition

More information

7.1 It is well known that the formula for converting a temperature in Celsius to Fahrenheit is. o F = 9 5 o C (7.10)

7.1 It is well known that the formula for converting a temperature in Celsius to Fahrenheit is. o F = 9 5 o C (7.10) 190 Engineering Software Development in Java 7.15 Exercises The problems in this section cover the basics, including use of keyboard input, looping and branching constructs, simple arrays, and generation

More information

Geometry Definitions and Theorems. Chapter 9. Definitions and Important Terms & Facts

Geometry Definitions and Theorems. Chapter 9. Definitions and Important Terms & Facts Geometry Definitions and Theorems Chapter 9 Definitions and Important Terms & Facts A circle is the set of points in a plane at a given distance from a given point in that plane. The given point is the

More information

C Programming for Engineers Structured Program

C Programming for Engineers Structured Program C Programming for Engineers Structured Program ICEN 360 Spring 2017 Prof. Dola Saha 1 Switch Statement Ø Used to select one of several alternatives Ø useful when the selection is based on the value of

More information

Score score < score < score < 65 Score < 50

Score score < score < score < 65 Score < 50 What if we need to write a code segment to assign letter grades based on exam scores according to the following rules. Write this using if-only. How to use if-else correctly in this example? score Score

More information

Algorithms. Abdelghani Bellaachia, CSCI 1121 Page: 1

Algorithms. Abdelghani Bellaachia, CSCI 1121 Page: 1 Algorithms 1. Objectives... 2 2. Design You Solution... 2 3. Structure of an algorithm:... 3 4. Pseudocode:... 4 5. Example... 5 6. Selection or Conditional Execution... 8 7. Looping or Iteration... 9

More information

Spelling-Punctuation-Grammar Subject How will you promote high standards within this module? Term Duration (approx.)

Spelling-Punctuation-Grammar Subject How will you promote high standards within this module? Term Duration (approx.) Term Cycle 1 6 lessons HTML Correct syntax needed for coding to work. Further coding units in Years 8 and 9 can be linked back to the experiences of using HTML. How to use HTML tags to create a range of

More information

PDS Lab Section 16 Autumn Tutorial 3. C Programming Constructs

PDS Lab Section 16 Autumn Tutorial 3. C Programming Constructs PDS Lab Section 16 Autumn-2017 Tutorial 3 C Programming Constructs This flowchart shows how to find the roots of a Quadratic equation Ax 2 +Bx+C = 0 Start Input A,B,C x B 2 4AC False x If 0 True B x 2A

More information

x + 2 = 0 or Our limits of integration will apparently be a = 2 and b = 4.

x + 2 = 0 or Our limits of integration will apparently be a = 2 and b = 4. QUIZ ON CHAPTER 6 - SOLUTIONS APPLICATIONS OF INTEGRALS; MATH 15 SPRING 17 KUNIYUKI 15 POINTS TOTAL, BUT 1 POINTS = 1% Note: The functions here are continuous on the intervals of interest. This guarantees

More information

Chapter 1: An Overview of Computers and Logic

Chapter 1: An Overview of Computers and Logic Chapter 1: An Overview of Computers and Logic Programming Logic and Design, Third Edition Comprehensive Objectives After studying Chapter 1, you should be able to: Understand computer components and operations

More information

Week 2. Relational Operators. Block or compound statement. if/else. Branching & Looping. Gaddis: Chapters 4 & 5. CS 5301 Spring 2018.

Week 2. Relational Operators. Block or compound statement. if/else. Branching & Looping. Gaddis: Chapters 4 & 5. CS 5301 Spring 2018. Week 2 Branching & Looping Gaddis: Chapters 4 & 5 CS 5301 Spring 2018 Jill Seaman 1 Relational Operators l relational operators (result is bool): == Equal to (do not use =)!= Not equal to > Greater than

More information

A Quick Review of Chapter 1

A Quick Review of Chapter 1 A Quick Review of Chapter 1 The core of computing is algorithms Algorithm A well-ordered collection of unambiguous and effectively computable operations that, when executed, produces a result and halts

More information

SECTION 5: STRUCTURED PROGRAMMING IN MATLAB. ENGR 112 Introduction to Engineering Computing

SECTION 5: STRUCTURED PROGRAMMING IN MATLAB. ENGR 112 Introduction to Engineering Computing SECTION 5: STRUCTURED PROGRAMMING IN MATLAB ENGR 112 Introduction to Engineering Computing 2 Conditional Statements if statements if else statements Logical and relational operators switch case statements

More information

Programming in C++ PART 2

Programming in C++ PART 2 Lecture 07-2 Programming in C++ PART 2 By Assistant Professor Dr. Ali Kattan 1 The while Loop and do..while loop In the previous lecture we studied the for Loop in C++. In this lecture we will cover iteration

More information

LAB 5: SELECTION STATEMENTS

LAB 5: SELECTION STATEMENTS Statement Purpose: The purpose of this lab is to familiarize students with Conditional statements and explain how to control the sequence of statement execution, depending on the value of an expression

More information

Introduction to Programming: Variables and Objects. HORT Lecture 7 Instructor: Kranthi Varala

Introduction to Programming: Variables and Objects. HORT Lecture 7 Instructor: Kranthi Varala Introduction to Programming: Variables and Objects HORT 59000 Lecture 7 Instructor: Kranthi Varala What is a program? A set of instructions to the computer that perform a specified task in a specified

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #16 Loops: Matrix Using Nested for Loop In this section, we will use the, for loop to code of the matrix problem.

More information

Assignment Volume and Surface Area of Solids

Assignment Volume and Surface Area of Solids Assignment Volume and Surface Area of Solids 1. (a) The diagonal of a cube is 16 3 cm. Find its surface area and volume. (b) The capacity of a cylindrical tank is 1848 m 3 and the diameter of its base

More information

Need more help with decimal subtraction? See T23. Note: The inequality sign is reversed only when multiplying or dividing by a negative number.

Need more help with decimal subtraction? See T23. Note: The inequality sign is reversed only when multiplying or dividing by a negative number. . (D) According to the histogram, junior boys sleep an average of.5 hours on a daily basis and junior girls sleep an average of. hours. To find how many more hours the average junior boy sleeps than the

More information

Repetition and Loop Statements Chapter 5

Repetition and Loop Statements Chapter 5 Repetition and Loop Statements Chapter 5 1 Chapter Objectives To understand why repetition is an important control structure in programming To learn about loop control variables and the three steps needed

More information

Warmup. April 28, 2017 Geometry 11.2 Areas of Circles and Sectors 1

Warmup. April 28, 2017 Geometry 11.2 Areas of Circles and Sectors 1 Warmup April 28, 2017 Geometry 11.2 Areas of Circles and Sectors 1 Geometry 11.2 Area of Circles and Sectors mbhaub@mpsaz.org 11.2 Essential Question How can you find the area of a sector of a circle?

More information

Lab 9: Creating a Reusable Class

Lab 9: Creating a Reusable Class Lab 9: Creating a Reusable Class Objective This will introduce the student to creating custom, reusable classes This will introduce the student to using the custom, reusable class This will reinforce programming

More information

Fundamentals of Computing and Digital Literacy. Sample. Assignment title: Develop a Wiki. Marking Scheme

Fundamentals of Computing and Digital Literacy. Sample. Assignment title: Develop a Wiki. Marking Scheme Fundamentals of Computing and Digital Literacy Sample Assignment title: Develop a Wiki Marking Scheme This Marking Scheme has been prepared as a guide only to markers. This is not a set of model answers,

More information

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 08: Control Statements Readings: Chapter 6 Control Statements and Their Types A control

More information

I101/B100 Problem Solving with Computers

I101/B100 Problem Solving with Computers I101/B100 Problem Solving with Computers By: Dr. Hossein Hakimzadeh Computer Science and Informatics IU South Bend 1 What skill are needed for software development? Problem Solving skills. People skills.

More information

Iteration. CSE / ENGR 142 Programming I. Chapter 5. Motivating Loops. One More Type of Control Flow. What s Wrong with HW1?

Iteration. CSE / ENGR 142 Programming I. Chapter 5. Motivating Loops. One More Type of Control Flow. What s Wrong with HW1? CSE / ENGR 142 Programming I Iteration Chapter 5 Read Sections 5.1-5.6, 5.10 5.1 Introduction & While Statement 5.2 While example 5.3 For Loop 5.4 Looping with a fixed bound 5.5 Loop design 5.6 Nested

More information

S3 (3.1) N5 Volume.notebook April 30, 2018

S3 (3.1) N5 Volume.notebook April 30, 2018 Daily Practice 16.3.2018 Q1. Multiply out and simplify (3x - 2)(x 2-7x + 3) Daily Practice 19.3.2018 Q1. Multiply out and simplify (2x + 3)(x 2 + 7x + 4) Q2. Factorise fully 3x 2-75 Q2. Simplify x 3 (x

More information

Introduction. C provides two styles of flow control:

Introduction. C provides two styles of flow control: Introduction C provides two styles of flow control: Branching Looping Branching is deciding what actions to take and looping is deciding how many times to take a certain action. Branching constructs: if

More information

Chapter 1: Problem Solving Skills Introduction to Programming GENG 200

Chapter 1: Problem Solving Skills Introduction to Programming GENG 200 Chapter 1: Problem Solving Skills Introduction to Programming GENG 200 Spring 2014, Prepared by Ali Abu Odeh 1 Table of Contents Fundamentals of Flowcharts 2 3 Flowchart with Conditions Flowchart with

More information

S3 (3.1) Volume.notebook March 02, 2016

S3 (3.1) Volume.notebook March 02, 2016 Daily Practice 22.2.2016 Q1. Multiply out and simplify (3x - 2)(x 2-7x + 3) Q2. Factorise fully 3x 2-75 L.I: Today we will be revising how to find the volume of a prism. Q3. Calculate the value of a house

More information

Applications of Integration. Copyright Cengage Learning. All rights reserved.

Applications of Integration. Copyright Cengage Learning. All rights reserved. Applications of Integration Copyright Cengage Learning. All rights reserved. Volume: The Disk Method Copyright Cengage Learning. All rights reserved. Objectives Find the volume of a solid of revolution

More information

Computers and FORTRAN Language Fortran 95/2003. Dr. Isaac Gang Tuesday March 1, 2011 Lecture 3 notes. Topics:

Computers and FORTRAN Language Fortran 95/2003. Dr. Isaac Gang Tuesday March 1, 2011 Lecture 3 notes. Topics: Computers and FORTRAN Language Fortran 95/2003 Dr. Isaac Gang Tuesday March 1, 2011 Lecture 3 notes Topics: - Program Design - Logical Operators - Logical Variables - Control Statements Any FORTRAN program

More information

Loops. Repeat after me

Loops. Repeat after me Loops Repeat after me 1 Loops A loop is a control structure in which a statement or set of statements execute repeatedly How many times the statements repeat is determined by the value of a control variable,

More information

Chapter Four: Loops. Slides by Evan Gallagher. C++ for Everyone by Cay Horstmann Copyright 2012 by John Wiley & Sons. All rights reserved

Chapter Four: Loops. Slides by Evan Gallagher. C++ for Everyone by Cay Horstmann Copyright 2012 by John Wiley & Sons. All rights reserved Chapter Four: Loops Slides by Evan Gallagher The Three Loops in C++ C++ has these three looping statements: while for do The while Loop while (condition) { statements } The condition is some kind of test

More information

Numerical Methods in Scientific Computation

Numerical Methods in Scientific Computation Numerical Methods in Scientific Computation Programming and Software Introduction to error analysis 1 Packages vs. Programming Packages MATLAB Excel Mathematica Maple Packages do the work for you Most

More information

5.1. Chapter 5: The Increment and Decrement Operators. The Increment and Decrement Operators. Looping. ++ is the increment operator.

5.1. Chapter 5: The Increment and Decrement Operators. The Increment and Decrement Operators. Looping. ++ is the increment operator. Chapter 5: Looping 5.1 The Increment and Decrement Operators Copyright 2009 Pearson Education, Inc. Copyright Publishing as Pearson 2009 Addison-Wesley Pearson Education, Inc. Publishing as Pearson Addison-Wesley

More information

(Section 6.2: Volumes of Solids of Revolution: Disk / Washer Methods)

(Section 6.2: Volumes of Solids of Revolution: Disk / Washer Methods) (Section 6.: Volumes of Solids of Revolution: Disk / Washer Methods) 6.. PART E: DISK METHOD vs. WASHER METHOD When using the Disk or Washer Method, we need to use toothpicks that are perpendicular to

More information

Center of a sphere. Radius of a sphere. Chord of a sphere. Diameter of a sphere

Center of a sphere. Radius of a sphere. Chord of a sphere. Diameter of a sphere 12.6 Surface Area and Volume of Spheres Goal p Find surface areas and volumes of spheres. Your Notes VOCABULARY Sphere Center of a sphere Radius of a sphere Chord of a sphere Diameter of a sphere Tangent

More information

Iteration. CSE / ENGR 142 Programming I. while loops. Chapter 5. Motivating Loops. Loop to Add 5 Numbers 1996 UW CSE H - 1

Iteration. CSE / ENGR 142 Programming I. while loops. Chapter 5. Motivating Loops. Loop to Add 5 Numbers 1996 UW CSE H - 1 CSE / ENGR 142 Programming I Iteration Chapter 5 Read Sections 5.1-5.6, 5.10 5.1 Introduction & While Statement 5.2 While example 5.3 For Loop 5.4 Looping with a fixed bound 5.5 Loop design 5.6 Nested

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 3 Thomas Wies New York University Review Last week Names and Bindings Lifetimes and Allocation Garbage Collection Scope Outline Control Flow Sequencing

More information

Grouping Objects. Primitive Arrays and Iteration. Produced by: Dr. Siobhán Drohan. Department of Computing and Mathematics

Grouping Objects. Primitive Arrays and Iteration. Produced by: Dr. Siobhán Drohan. Department of Computing and Mathematics Grouping Objects Primitive Arrays and Iteration Produced by: Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topic List Primitive arrays Why do we need them? What are they?

More information

Structured Programming. Dr. Mohamed Khedr Lecture 9

Structured Programming. Dr. Mohamed Khedr Lecture 9 Structured Programming Dr. Mohamed Khedr http://webmail.aast.edu/~khedr 1 Two Types of Loops count controlled loops repeat a specified number of times event-controlled loops some condition within the loop

More information

SPHERES WHAT YOU LL LEARN. Ø Finding the surface area of a sphere Ø Finding the volume of a sphere

SPHERES WHAT YOU LL LEARN. Ø Finding the surface area of a sphere Ø Finding the volume of a sphere SPHERES A sphere is the locus of points in space that are a given distance from a point. The point is called the center of the sphere. A radius of a sphere is a segment from the center to a point on the

More information

Loop Structures. Loop Structures. Algorithm to record 5 TV programmes. Recall Structured Programming..3 basic control structures.

Loop Structures. Loop Structures. Algorithm to record 5 TV programmes. Recall Structured Programming..3 basic control structures. Loop Structures Recall Structured Programming..3 basic control structures Sequence Input -> Process -> Output Selection IF ENDIF SELECT CASE END SELECT Loop Structures DO WHILE LOOP DO LOOP UNTIL FOR NEXT

More information

FORMULAE: VOLUMES & SURFACE AREA 1. Cuboid Let, length = l, breadth = b and height = h units. (i) Volume of Cuboid = (l b h) cubic units. (ii) Whole surface of cuboid = (lb + bh + lh) sq.units. (iii) Diagonal

More information

Chapter Two: Program Design Process and Logic

Chapter Two: Program Design Process and Logic Chapter Two: Program Design Process and Logic 2.1 Chapter objectives Describe the steps involved in the programming process Understand how to use flowchart symbols and pseudocode statements Use a sentinel,

More information

APPM 2460: Week Three For, While and If s

APPM 2460: Week Three For, While and If s APPM 2460: Week Three For, While and If s 1 Introduction Today we will learn a little more about programming. This time we will learn how to use for loops, while loops and if statements. 2 The For Loop

More information

Chapter 2: Algorithm Discovery and Design. Invitation to Computer Science, C++ Version, Fourth Edition

Chapter 2: Algorithm Discovery and Design. Invitation to Computer Science, C++ Version, Fourth Edition Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Fourth Edition Objectives In this chapter, you will learn about Representing algorithms Examples of algorithmic problem

More information

Grade VIII. Mathematics Geometry Notes. #GrowWithGreen

Grade VIII. Mathematics Geometry Notes. #GrowWithGreen Grade VIII Mathematics Geometry Notes #GrowWithGreen Polygons can be classified according to their number of sides (or vertices). The sum of all the interior angles of an n -sided polygon is given by,

More information

REPRESENTING ALGORITHMS. REPRESENTING ALGORITHMS IB DP Computer science Standard Level ICS3U

REPRESENTING ALGORITHMS. REPRESENTING ALGORITHMS IB DP Computer science Standard Level ICS3U C A N A D I A N I N T E R N A T I O N A L S C H O O L O F H O N G K O N G 2.1 Introduction 2.2 Representing Algorithms algorithm should be clear, precise, and unambiguous one possibility is to use the

More information

Programming Language. Control Structures: Repetition (while) Eng. Anis Nazer Second Semester

Programming Language. Control Structures: Repetition (while) Eng. Anis Nazer Second Semester Programming Language Control Structures: Repetition (while) Eng. Anis Nazer Second Semester 2017-2018 Repetition statements Control statements change the order which statements are executed Selection :

More information

An Introduction to Programming with C++ Sixth Edition. Chapter 8 More on the Repetition Structure

An Introduction to Programming with C++ Sixth Edition. Chapter 8 More on the Repetition Structure An Introduction to Programming with C++ Sixth Edition Chapter 8 More on the Repetition Structure Objectives Include a posttest loop in pseudocode Include a posttest loop in a flowchart Code a posttest

More information

CBSE X Mathematics 2012 Solution (SET 1) Section C

CBSE X Mathematics 2012 Solution (SET 1) Section C CBSE X Mathematics 01 Solution (SET 1) Q19. Solve for x : 4x 4ax + (a b ) = 0 Section C The given quadratic equation is x ax a b 4x 4ax a b 0 4x 4ax a b a b 0 4 4 0. 4 x [ a a b b] x ( a b)( a b) 0 4x

More information

Double Integrals over Polar Coordinate

Double Integrals over Polar Coordinate 1. 15.4 DOUBLE INTEGRALS OVER POLAR COORDINATE 1 15.4 Double Integrals over Polar Coordinate 1. Polar Coordinates. The polar coordinates (r, θ) of a point are related to the rectangular coordinates (x,y)

More information

Gaddis: Starting Out with Alice Test Bank Chapter Two 1 Chapter Two

Gaddis: Starting Out with Alice Test Bank Chapter Two 1 Chapter Two Gaddis: Starting Out with Alice Test Bank Chapter Two 1 Chapter Two MULTIPLE CHOICE 1. What is the name of the default world method that automatically runs when an Alice program is executed? a. the first

More information

Cutoff.Guru. Recruitment16.in. Recruitment16.in copyright Geometry and Mensuration. Some important mensuration formulas are:

Cutoff.Guru. Recruitment16.in. Recruitment16.in copyright Geometry and Mensuration. Some important mensuration formulas are: Geometry and Mensuration Mensuration: Mensuration is the branch of mathematics which deals with the study of Geometric shapes, Their area, Volume and different parameters in geometric objects. Some important

More information

Chapter 6 More About Loops and Decisions PRELUDE TO PROGRAMMING, 6TH EDITION BY ELIZABETH DRAKE

Chapter 6 More About Loops and Decisions PRELUDE TO PROGRAMMING, 6TH EDITION BY ELIZABETH DRAKE Chapter 6 More About Loops and Decisions 6.1 Combining Loops With If-Then Statements By combining loops and decision structures, programs become much more complex. Loops can be nested inside selecjon structures

More information

Mr. Whelan Name: Block:

Mr. Whelan Name: Block: Mr. Whelan Name: Block: Geometry/Trig Unit 10 Area and Volume of Solids Notes Packet Day 1 Notes - Prisms Rectangular Prism: How do we find Total Area? Example 1 6cm Find the area of each face: Front:

More information

Chapter 2. Designing a Program. Input, Processing, and Output Fall 2016, CSUS. Chapter 2.1

Chapter 2. Designing a Program. Input, Processing, and Output Fall 2016, CSUS. Chapter 2.1 Chapter 2 Input, Processing, and Output Fall 2016, CSUS Designing a Program Chapter 2.1 1 Algorithms They are the logic on how to do something how to compute the value of Pi how to delete a file how to

More information

Volume of Cylinders. Volume of Cones. Example Find the volume of the cylinder. Round to the nearest tenth.

Volume of Cylinders. Volume of Cones. Example Find the volume of the cylinder. Round to the nearest tenth. Volume of Cylinders As with prisms, the area of the base of a cylinder tells the number of cubic units in one layer. The height tells how many layers there are in the cylinder. The volume V of a cylinder

More information

SP about Rectangular Blocks

SP about Rectangular Blocks 1 3D Measure Outcomes Recognise and draw the nets of prisms, cylinders, and cones. Solve problems about the surface area and volume of rectangular blocks, cylinders, right cones, prisms, spheres, and solids

More information

Repetition Structures II

Repetition Structures II Lecture 9 Repetition Structures II For and do-while loops CptS 121 Summer 2016 Armen Abnousi Types of Control Structures Sequential All programs that we have written so far The statements inside a pair

More information

Top-Down Program Development

Top-Down Program Development Top-Down Program Development Top-down development is a way of thinking when you try to solve a programming problem It involves starting with the entire problem, and breaking it down into more manageable

More information

Sect Volume. 3 ft. 2 ft. 5 ft

Sect Volume. 3 ft. 2 ft. 5 ft 199 Sect 8.5 - Volume Objective a & b: Understanding Volume of Various Solids The Volume is the amount of space a three dimensional object occupies. Volume is measured in cubic units such as in or cm.

More information

COP 1220 Introduction to Programming in C++ Course Justification

COP 1220 Introduction to Programming in C++ Course Justification Course Justification This course is a required first programming C++ course in the following degrees: Associate of Arts in Computer Science, Associate in Science: Computer Programming and Analysis; Game

More information