Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 9 Decisions, Decisions, Decisions.

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

Nested if-else Statements.  Should be indented to make the logic clear.  Nested statement executed only when the branch it is in is executed. For example,
More on Algorithms and Problem Solving
1.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 4 Making Decisions in a Program.
COMPUTER PROGRAMMING I Understand Problem Solving Tools to Design Programming Solutions.
Programming with Microsoft Visual Basic th Edition
Chapter 4: The Selection Structure Programming with Microsoft Visual Basic.NET, Second Edition.
Chapter 4 Control Structures I. Objectives ► Examine relational and logical operators ► Explore how to form and evaluate logical (Boolean) expressions.
Chapter 2- Visual Basic Schneider
Compunet Corporation1 Programming with Visual Basic.NET Selection Structure If-Else Week 4 Tariq Ibn Aziz.
Decisions (Conditional Programming) Chapter 5 (Sec. 5.1 & 5.2)
Chapter 5: More on the Selection Structure Programming with Microsoft Visual Basic.NET, Second Edition.
Developing logic (Examples on algorithm and flowchart)
The Program Design Phases
CSC103: Introduction to Computer and Programming
Chapter Four The Selection Structure
Microsoft Visual Basic 2008: Reloaded Fourth Edition
Chapter 4: The Selection Structure
Flow Charting. Goals Create Algorithms using Flow Charting procedures. Distinguish between Flow Charting and Pseudocode. Top-Down Design Bottom-up Design.
Computer Programming TCP1224 Chapter 2 Beginning the Problem-Solving Process.
Chapter 4: The Selection Structure Programming with Microsoft Visual Basic 2005, Third Edition.
Chapter 4: The Selection Structure
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Structural Program Development: If, If-Else Outline.
1 Chapter 4: Selection Structures. In this chapter, you will learn about: – Selection criteria – The if-else statement – Nested if statements – The switch.
Flowcharts! January 13, 2005 These are today’s notes! Do you think we will get more snow?
Programming Logic and Design, Second Edition, Comprehensive
Lecture 2: Logical Problems with Choices. Problem Solving Before writing a program Have a thorough understanding of the problem Carefully plan an approach.
Chapter 5: More on the Selection Structure Programming with Microsoft Visual Basic 2005, Third Edition.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
Pseudocode. Simple Program Design, Fourth Edition Chapter 2 2 Objectives In this chapter you will be able to: Introduce common words, keywords, and meaningful.
ALGORITHM List of instructions for carrying out some process step by step. A sequence of instructions which has a clear meaning and can performed with.
Chapter 1: An Introduction to Control Structures Introduction to Programming with C++ Fourth Edition.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 5: More on the Selection Structure
Programming with Microsoft Visual Basic th Edition
Computer Programming TCP1224 Chapter 5 The Selection Structure.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 13 How Long Can This Go On?
Chapter 13 Do It, Then Ask Permission (Posttest Loops) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 14 Do It, Then Ask Permission.
Tutorial 4: The Selection Structure 1 Tutorial 4 The Selection Structure.
Chapter 10 So Many Paths … So Little Time (Multiple-Alternative Selection Structures) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Chapter Five More on the Selection Structure Programming with Microsoft Visual Basic th Edition.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
An Introduction to Programming with C++1 The Selection Structure Tutorial 6.
Flow Charts And Pseudo Codes Grade 12. An algorithm is a complete step-by- step procedure for solving a problem or accomplishing a task.
C++ for Engineers and Scientists Second Edition Chapter 4 Selection Structures.
Understand Problem Solving Tools to Design Programming Solutions
More on the Selection Structure
The Selection Structure
Chapter 5 Decisions. Chapter 5 Decisions ssential uestion: How are Boolean expressions or operators used in everyday life?
Chapter 4: The Selection Structure
Numbering System TODAY AND TOMORROW 11th Edition
Programming Fundamentals
Programming with Microsoft Visual Basic 2008 Fourth Edition
An Introduction to Programming with C++ Fifth Edition
Microsoft Visual Basic 2005 BASICS
Making Decisions in a Program
MSIS 655 Advanced Business Applications Programming
Objectives After studying this chapter, you should be able to:
1) C program development 2) Selection structure
Chapter 8: More on the Repetition Structure
Chapter 2- Visual Basic Schneider
Microsoft Visual Basic 2005: Reloaded Second Edition
Chapter 5: The Selection Structure
WJEC GCSE Computer Science
Structural Program Development: If, If-Else
Presentation transcript:

Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 9 Decisions, Decisions, Decisions

Clearly Visual Basic: Programming with Visual Basic 2008 Objectives Show the selection structure in both pseudocode and a flowchart Write If…Then…Else statements Include comparison operators in a selection structure’s condition Add a check box to an interface 2

Clearly Visual Basic: Programming with Visual Basic 2008 Someone Might Need to Make a Decision All computer programs are written using one or more of three control structures –Sequence, selection, or repetition Selection structure –Makes a decision and then takes appropriate action based on that decision Studying problem specification –Determines whether problem’s solution requires a selection structure 3

4Clearly Visual Basic: Programming with Visual Basic 2008

5

6

7

8 Going Beyond Rob’s Problems Figure 9-5 shows: –Problem specification that does not involve Rob, the mechanical man –Correct algorithm for the problem

9Clearly Visual Basic: Programming with Visual Basic 2008

The If … Then … Else Statement Comparison operators –Used to compare values Statement block –Set of statements contained in the true path and the false path All expressions containing a comparison operator –Will result in an answer of either True or False only 10Clearly Visual Basic: Programming with Visual Basic 2008

11

12Clearly Visual Basic: Programming with Visual Basic 2008

13Clearly Visual Basic: Programming with Visual Basic 2008

Examining Another Problem Specification Oval in a flowchart –Is the start/stop symbol Rectangle in a flowchart –Is the process symbol Parallelogram in a flowchart –Is the input/output symbol Diamond in a flowchart –Is called the selection/repetition symbol 14Clearly Visual Basic: Programming with Visual Basic 2008

15Clearly Visual Basic: Programming with Visual Basic 2008

16Clearly Visual Basic: Programming with Visual Basic 2008

Hey, That’s Not the Way I Would Have Done It Variable that has procedure scope –Can be used anywhere within the procedure Variable that has block scope –Can be used only within the statement block in which it is declared Block variable –Variable declared within a statement block 17Clearly Visual Basic: Programming with Visual Basic 2008

18Clearly Visual Basic: Programming with Visual Basic 2008

19Clearly Visual Basic: Programming with Visual Basic 2008

Summary Selection structure –One of the three control structures Indent instructions in a selection structure’s true path and its false path In Visual Basic –You can use the If…Then…Else statement to code the selection structure An expression containing a comparison operator –Will always evaluate to either True or False 20Clearly Visual Basic: Programming with Visual Basic 2008

Summary (continued) In a flowchart –The selection structure’s condition is represented by a diamond chk –The three-character ID used when naming check boxes Block variable –Has block scope 21Clearly Visual Basic: Programming with Visual Basic 2008