Control structures Chapter 3.

Slides:



Advertisements
Similar presentations
I Spy! Shapes in our world.
Advertisements

Repetition Statements Perform the same task repeatedly Allow the computer to do the tedious, boring things.
FRACTIONS.
Chapter 4 Ch 1 – Introduction to Computers and Java Flow of Control Loops 1.
For(int i = 1; i
Control Flow Statements: Repetition/Looping
CS 101 Introductory Programming - Lecture 7: Loops In C & Good Coding Practices Presenter: Ankur Chattopadhyay.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
A loop is a repetition control structure. it causes a single statement or block to be executed repeatedly What is a loop?
Loops – While, Do, For Repetition Statements Introduction to Arrays
1 Lecture 14 Chapter 6 Looping Dale/Weems/Headington.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
1 4.8The do/while Repetition Structure The do/while repetition structure –Similar to the while structure –Condition for repetition tested after the body.
Flowcharts! January 13, 2005 These are today’s notes! Do you think we will get more snow?
Variables and Arithmetic. From last class More drawing functions: strokeWeight(n); // higher the n value broader the stroke fill(k) ; // single parameter.
5-1 Repetition Statements Repetition statements allow us to execute a statement multiple times Often they are referred to as loops Like conditional statements,
Review of CIS 120 Concepts: What you said you want….
Chapter 3 Control Statements F Selection Statements –Using if and if...else –Nested if Statements –Using switch Statements –Conditional Operator F Repetition.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 5: Introduction to C: More Control Flow.
1 Chap 4. Data Should know Declare & Initialize variables Declare constants Assignment Operators Increment and Decrement Operators Precedence of Operators.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
Program Units and Data §Program Unit Structure §Declarative Part: Data Structures §Procedural Part: Statements §Procedures §Calling the procedures or.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Branching ACO101: Introduction to Computer Science.
Counting Loops.
Repetition Control Structure. Introduction Many applications require certain operations to be carried out more than once. Such situations require repetition.
Week 8 - Friday.  What did we talk about last time?  Static methods.
1 For Loops l From Chapter 9 l A shorthand way of coding count loops.
USING CONDITIONAL CODE AMIR KHANZADA. Conditional Statement  Conditional statements are the set of commands used to perform different actions based on.
Alterations u assignment is the operation provided by programming languages for altering the value stored by a variable. u The assignment operator (=)
C syntax (simplified) BNF. Program ::= [ ] Directives ::= [ ] ::= | |… ::=#include > ::=#define.
Chapter 7 Control Structures. Java has very flexible three looping mechanisms. You can use one of the following three loops:  while Loop  do...while.
Conditional Statements A conditional statement lets us choose which statement will be executed next Conditional statements give us the power to make basic.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 6: Stepwise refinement revisited, Midterm review.
Loops. About the Midterm Exam.. Exam on March 12 Monday (tentatively) Review on March 5.
Chapter 9 Repetition.
Computer Programming.
Chapter 4 – C Program Control
Exam 2 Review.
Sorting and Grouping.
Compound Condition Break , Continue Switch Statements in Java
Unit-1 Introduction to Java
Week 8 - Friday CS 121.
CiS 260: App Dev I Chapter 4: Control Structures II.
Name the shape below. rectangle rhombus square triangle A B C D
Chapter 5 Repetition.
الكلية الجامعية للعلوم التطبيقية
HYBRID INHERITANCE : AMBIGUITY REMOVAL
On your whiteboards… Find the area 6cm 3cm.
Topic 1: Problem Solving
Bools & Ifs.
Let’s play with shapes! play.
Let’s Learn Understand the Problem:
Control structures Chapter 3.
CS139 October 11, 2004.
Shapes.
BBIT 212/ CISY 111 Object Oriented Programming (OOP)
Control structures Chapter 3.
Adding Behaviors (methods)
Final Review Bina Ramamurthy 4/5/2019 BR.
Control structures Chapter 3.
Final Review Bina Ramamurthy 4/15/2019 BR.
Millennium High School Agenda Calendar
What are different ways to show fractions?
Unit-2 Objects and Classes
Lesson 3. Controlling program flow. Loops. Methods. Arrays.
Chapter Equations of Circles.
Exam3 Review CSE113 B.Ramamurthy 10/11/2019 B.Ramamurthy.
Final Exam Review CSE113 B.Ramamurthy 10/13/2019 B.Ramamurthy.
2D Shapes Rectangle Circle Triangle Rectangle. What shape is the door? Rectangle.
Presentation transcript:

Control structures Chapter 3

Topics Assignment statement Selection: if..else Multi-way selection: switch Repetition: p.88, 89 Functions: setup(), draw(), mousePressed()

Repetition Three kinds of loops For loop While loop Do while loop

Loops syntax While loop int i =0; while (i < 100) { do something; i = i + 1; } For loop for (int i =0; i < 100; i = i +1) {

Loops syntax (contd.) int i = 0; Do { do something; i = i + 1; } while (i < 100);

Lets apply this to drawing some shapes On to Processing: Draw 10 rectangles of different sizes and at different locations Draw 10 circles of different sizes and at different locations Parameter passing