Computers & Programming Languages

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

3-1 Chapter 3 Flow of Control (part a - branching)
Chapter 13 Control Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Control Structures Conditional.
Fundamental Programming Structures in Java: Control Flow, Arrays and Vectors.
Selection (decision) control structure Learning objective
Lesson 5 - Decision Structure By: Dan Lunney
Conditional statements and Boolean expressions. The if-statement in Java (1) The if-statement is a conditional statement The statement is executed only.
Chapter 4 Control Structures I. Objectives ► Examine relational and logical operators ► Explore how to form and evaluate logical (Boolean) expressions.
2-1 Making Decisions Sample assignment statements PayAmount = Hours * Rate PayAmount = 40*Rate + (Hours – 40)*Rate*1.5.
Slides prepared by Rose Williams, Binghamton University Chapter 3 Flow of Control Loops in Java.
1 Arithmetic in C. 2 Type Casting: STOPPED You can change the data type of the variable in an expression by: (data_Type) Variable_Name Ex: int a = 15;
Chapter 4: Control Structures: Selection
The Program Design Phases
True or False Unit 3 Lesson 7 Building Blocks of Decision Making With Additions & Modifications by Mr. Dave Clausen True or False.
1. Know the different types of flow block 2. Understand how problems can be broken down into smaller problems.
Branching and Conditions CSIS 1595: Fundamentals of Programming and Problem Solving 1.
1. We’ve learned that our programs are read by the compiler in order, from top to bottom, just as they are written The order of statement execution is.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 4 Decision.
Lecture 2: Logical Problems with Choices. Problem Solving Before writing a program Have a thorough understanding of the problem Carefully plan an approach.
Lesson 1-3 Example What number goes in the blank to make (7 + 5) + 4 = ___ + (14 – 2) a true equation? Step 1 The expressions inside the parentheses.
Branches and Program Design
1 2. Program Construction in Java. 2.4 Selection (decisions)
Computer Science: A Structured Programming Approach Using C1 5-2 Two-Way Selection The decision is described to the computer as a conditional statement.
Computer Science: A Structured Programming Approach Using C1 5-2 Two-Way Selection The decision is described to the computer as a conditional statement.
Chapter 4 Control Structures I. Chapter Objectives Learn about control structures Examine relational and logical operators Explore how to form and evaluate.
Basic Conditions. Challenge: ● Ask the user his/her name ● If it’s “Wally,” jeer him ● Pause video and try on your own.
Holt McDougal Algebra Solving Absolute-Value Inequalities Solve compound inequalities in one variable involving absolute-value expressions. Objectives.
3.1.3 Program Flow control Structured programming – SELECTION in greater detail.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Design A software design specifies how a program will accomplish its requirements A design includes one or more algorithms to accomplish its goal.
Introduction to Programming G50PRO University of Nottingham Unit 6 : Control Flow Statements 2 Paul Tennent
What Do Computers Do? A computer system is
Program design Program Design Process has 2 phases:
CNG 140 C Programming (Lecture set 3)
‘C’ Programming Khalid Jamal.
Objectives Solve compound inequalities in one variable involving absolute-value expressions. When an inequality contains an absolute-value expression,
ALGORITHMS CONDITIONAL BRANCH CONTROL STRUCTURE
Sequence, Selection, Iteration The IF Statement
Decisions Chapter 4.
Selection—Making Decisions
EKT150 INTRODUCTION TO COMPUTER PROGRAMMING
Solving Absolute Value Equations and Inequalities
Chapter 5 Decisions. Chapter 5 Decisions ssential uestion: How are Boolean expressions or operators used in everyday life?
Numbering System TODAY AND TOMORROW 11th Edition
White-Box Testing.
Control Structures.
Microsoft Visual Basic 2005 BASICS
Loop Control Structure.
Lesson 8: Boolean Expressions and "if" Statements
2-1 Making Decisions Sample assignment statements
IF if (condition) { Process… }
Computers & Programming Languages
Computers & Programming Languages
Scratch: selection / branching/ if / If…else / compound conditionals / error trapping by Mr. Clausen.
Program Flow Control Selection & repetition
What is an equation? An equation is a mathematical statement that two expressions are equal. For example, = 7 is an equation. Note: An equation.
Visual Basic – Decision Statements
Selection Statements.
GCSE Computer Science – Logic Gates & Boolean Expressions
Conditional Logic Presentation Name Course Name
Decision I (if Statement)
SECTION 2-4 : SOLVING EQUATIONS WITH THE VARIABLE ON BOTH SIDES
Lecture Notes – Week 2 Lecture-2
Program Flow.
Chapter 4: Boolean Expressions, Making Decisions, and Disk Input and Output Prof. Salim Arfaoui.
Selection—Making Decisions
A3 2.1d To Solve Compound Inequalities
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.
3.0 - Design A software design specifies how a program will accomplish its requirements A design includes one or more algorithms to accomplish its goal.
Presentation transcript:

Computers & Programming Languages

Selection – One Way Selection Lesson3- Objectives Use branched flow chart. Use one way selection to solve problems.

Program needs to take decision based on conditions occurrence Branched Flow Chart Program needs to take decision based on conditions occurrence Condition2 Condition3 Condition1

One way selection IF (logical Expression ) الشرط Statement النتيجة

One way selection If (mark>= 90) grade = ‘A’;

Type the program in P-224 and check the results Book Practical Activity P-224 Type the program in P-224 and check the results

Algorithm Book Activity P-225 End Start Input Speed msg True False

Program

Compound Block of Statement When the program execute more statements executed when logical expression evaluates to true we call this “Compound Statement”

Book Activity P-227 This msg is suppose to appear for negative and positive numbers

Class Activity Book Activity P-229 Total Salary = (salary * 0.22) + Salary

Program The msg is written inside the if brackets because I need the msg to appear only if the total salary is > 40

Class Activity Create a java program to get the value of x as per the following equations:

Program