Announcements Quiz 1 Posted on blackboard

Slides:



Advertisements
Similar presentations
Do-while Loops Programming. COMP102 Prog Fundamentals I: do-while Loops /Slide 2 The do-while Statement l Syntax do action while (condition) l How it.
Advertisements

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie July 5, 2005.
5-1 Flow of Control Recitation-01/25/2008  CS 180  Department of Computer Science  Purdue University.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 4: Control Structures I (Selection)
Announcements Quiz 1 Posted on blackboard Handed Back (and Gone Over)Next Monday “Only a Quiz” Counts 5% of Final Grade Exam 1 Counts 10%
1 CS 105 Lecture 4 Selection Statements Wed, Jan 26, 2011, 6:05 pm.
Repetition Structures: For Loop Constants CSC 1401: Introduction to Programming with Java Week 5 Wanda M. Kunkle.
COMP 14 Introduction to Programming Miguel A. Otaduy May 20, 2004.
Loops Repetition Statements. Repetition statements allow us to execute a statement multiple times Often they are referred to as loops Like conditional.
1 CS 105 Lecture 5 Logical Operators; Switch Statement Wed, Feb 16, 2011, 5:11 pm.
ECE122 L9: While loops March 1, 2007 ECE 122 Engineering Problem Solving with Java Lecture 9 While Loops.
More on Input Output Input Stream : A sequence of characters from an input device (like the keyboard) to the computer (the program running). Output Stream.
Selection (if-then-else) Programming Has 3 Types of Control: Sequential (normal): Control of Execution Proceeds One after the Other Selection (if-then-else):
Flow of Control Part 1: Selection
If Statements If statements: allow the computer to make a decision Syntax: if (some condition) { then do this; } else { then do that; } no semicolons on.
Chapter 3 - Structured Program Development Outline 3.1Introduction 3.2Algorithms 3.3Pseudocode 3.4Control Structures 3.5The If Selection Structure 3.6The.
Lecture 4: C/C++ Control Structures Computer Programming Control Structures Lecture No. 4.
CONTROL STRUCTURE. 2 CHAPTER OBJECTIVES  Learn about control structures.  Examine relational and logical operators.  Explore how to form and evaluate.
1 CS 177 Week 6 Recitation Slides Review for Midterm Exam.
Repetition Statements (Loops). 2 Introduction to Loops We all know that much of the work a computer does is repeated many times. When a program repeats.
COMP Loop Statements Yi Hong May 21, 2015.
Algorithms JPC and JWD © 2002 McGraw-Hill, Inc. 2 Algorithms 2 An Algorithm is a finite set of precise instructions for performing a computation or for.
USING CONDITIONAL CODE AMIR KHANZADA. Conditional Statement  Conditional statements are the set of commands used to perform different actions based on.
Chapter 7 Control Structures. Java has very flexible three looping mechanisms. You can use one of the following three loops:  while Loop  do...while.
Selection (if-then-else) Programming Has 3 Types of Control: Sequential (normal): Control of Execution Proceeds One after the Other Selection (if-then-else):
Quiz 1 Exam 1 Next Monday. Nested if Statements if (myGrade >= 80) if (myGrade >= 90) System.out.println(“You have an A!” ); else System.out.println(“You.
Loops causes program to execute the certain block of code repeatedly until some conditions are satisfied. Suppose you want to execute some code/s 10 times.
Follow up from lab See Magic8Ball.java Issues that you ran into.
Chapter 9 Repetition.
Sequence, Selection, Iteration The IF Statement
Chapter 3 Edited by JJ Shepherd
Java Programming: From The ground Up
Introduction to programming in java
CiS 260: App Dev I Chapter 4: Control Structures II.
Lecturer CS & IT Department UOS MBDIN
Chapter 5: Control Structures II
Bools & Ifs.
Chapter 5 Structures.
Announcements Exam 1 Grades Posted on Blackboard.
Chapter 5 Repetition.
For Loops October 12, 2017.
Chapter 10 Programming Fundamentals with JavaScript
Conditional Statements
Chapter 9 Control Structures.
Selection (if-then-else)
محاضرة 1: مقدمة للمسـاق و مراجعـة للأساسيـات
Selection CSCE 121 J. Michael Moore.
CS190/295 Programming in Python for Life Sciences: Lecture 6
Chapter (3) - Looping Questions.
Know for Quiz Everything through Last Week and Lab 7
Unit 3 - The while Loop - Extending the Vic class - Examples
3 Control Statements:.
Announcements Exam 1 Thursday 50 minutes 10 % of Total Grade
Announcements Exam 1 Thursday Everything through Lab 5 50 minutes
Announcements Exam 1 Grades Posted on Blackboard.
LabVIEW.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Chapter 4: Control Structures I (Selection)
Control Structure Chapter 3.
Lecture 1 Review of 1301/1321 CSE /26/2018.
A LESSON IN LOOPING What is a loop?
CS2011 Introduction to Programming I Selections (I)
If-statements & Indefinite Loops
Chapter 4: Boolean Expressions, Making Decisions, and Disk Input and Output Prof. Salim Arfaoui.
There many situations comes in real life when we need to make some decisions and based on these decisions, we decide what should we do next. Similar situations.
Control Structure.
Flow of Control Flow of control is the order in which a program performs actions. Up to this point, the order has been sequential. A branching statement.
Announcements Exercise Sets 2 and 3 Due Thursday.
Announcements Exam 1 Grades Posted on blackboard Average: 83.26
Control Statements:.
Presentation transcript:

Announcements Quiz 1 Posted on blackboard Quiz 1 Handed Back (and Gone Over) Next Monday “Just a Quiz” 5% of Final Grade Exam 1 is 10% of Final Grade

Selection (if-then-else) Programming Has 3 Types of Control: Sequential (normal): Control of Execution Proceeds One after the Other Selection (if-then-else): Control Proceeds Dependent on Conditions Iteration (looping): Control Repeated until Condition Met

JAVA if Statement Syntax if (condition) statement; If Condition Is True, Statement Is Executed If Condition Is False, Statement Is Not Executed If Multiple Actions Are Required for Statement, a Compound Statement Must Be Used: if (condition) { statement; }

Conditional Operators Relational Operators: < , > , >= , <= Equality Operators: == , !=

Comparing Strings Cannot use Equality Operators Use .equals() instead: String myString; … if (myString.equals(“Hello”) ) System.out.println(“Well, Hello to you too!!”);

Selection Examples int age; char grade; String firstName; //Code to assign to age, grade, and firstName if (age < 30) System.out.println( “You are very very Young”); if (grade == ‘A’) System.out.println(“Congratulations!” ); if (grade != ‘F’) System.out.println(“You passed!” ); if (firstName.equals(“Jon”)) System.out.println(“Thanks, Jon!” );

else Statement Syntax: if (condition) { } else statement(s); //condition true } else statement(s); //condition false

if-else Example if (myGrade >= 60) { System.out.println(“You passed!” ); } else System.out.println(“How about them Cubs?” );

Compound Statements Compound Statement: One or More Statements within a Set of Curly Braces Must Use Compound Statement if More than One Statement Is Supposed to be under Control of if or else Conditional Include Curly Braces after if so if other Statements Are Added in Future, Curly Braces Are Already There