Clear and Unclear Windows

Slides:



Advertisements
Similar presentations
Chapter 4 - Control Statements
Advertisements

Logic & program control part 3: Compound selection structures.
Problem Solving and Program Design in C (5th Edition) by Jeri R. Hanly and Elliot B. Koffman Chapter 4 (Conditional Statements) © CPCS
Switch Switch case statements are a substitute for long if statements that compare a variable to several "integral" values ("integral" values are simply.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1.
CS 106 Introduction to Computer Science I 09 / 28 / 2007 Instructor: Michael Eckmann.
The graphing calculator can be a great checking tool or a fast way to answer a multiple choice question. Example – suppose you graphed the following and.
Presented by Joaquin Vila Prepared by Sally Scott ACS 168 Problem Solving Using the Computer Week 12 Boolean Expressions, Switches, For-Loops Chapter 7.
Java Programming Constructs 1 MIS 3023 Business Programming Concepts II The University of Tulsa Professor: Akhilesh Bajaj All slides in this presentation.
While Loops Indefinite Iteration. Last lesson we looked at definite loops using the ‘For’ statement. The while loop keeps going while some condition is.
Programming Fundamentals. Today’s lecture Decisions If else …… Switch Conditional Operators Logical Operators.
Fundamental Programming Fundamental Programming More on Selection.
Copyright © 2012 Pearson Education, Inc. Chapter 4: Making Decisions.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 9 – Income Tax Calculator Application: Introducing.
Decisions and Debugging Part06dbg --- if/else, switch, validating data, and enhanced MessageBoxes.
Multi Way Selection You can choose statement(s) to run from many sets of choices. There are two cases for this: (a)Multi way selection by nested IF structure.
Review the following: if-else One branch if Conditional operators Logical operators Switch statement Conditional expression operator Nested ifs if –else.
Chapter 4 Making Decision Csc 125 C++ programming language Fall 2005.
Copyright 2003 Scott/Jones Publishing Making Decisions.
Chapter Making Decisions 4. Relational Operators 4.1.
Review while loops Control variables Example Infinite loop
ECA 225 Applied Interactive Programming ECA 225 Applied Online Programming control structures, events, objects.
Data Validation while loops. Data validation Programs get input data from different sources All data should be ‘validated’ before the program tries to.
Error Handling Tonga Institute of Higher Education.
EGR 115 Introduction to Computing for Engineers Branching & Program Design – Part 3 Friday 03 Oct 2014 EGR 115 Introduction to Computing for Engineers.
Lecture 7: Menus and getting input. switch Multiple-selection Statement switch Useful when a variable or expression is tested for all the values it can.
CS 141 Computer Programming 1 Branching Statements.
 CSC111 Quick Revision. Problem Write a java code that read a string, then show a list of options to the user to select from them, where:  L to print.
While loops. Iteration We’ve seen many places where repetition is necessary in a problem. We’ve been using the for loop for that purpose For loops are.
JavaScript 101 Lesson 6: Introduction to Functions.
More on conditional statements. Conditionals In some situations the typical if-else statements may become cumbersome Depending on the situation, there.
 Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
A451 Theory – 7 Programming 7A, B - Algorithms.
Chapter 5 The if Statement
The switch Statement, and Introduction to Looping
Compound Condition Break , Continue Switch Statements in Java
Chapter 4: Making Decisions.
Python: Control Structures
Chapter 4 (Conditional Statements)
Chapter Topics 11.1 Introduction to Menu-Driven Programs
Chapter 3 Control Statements Lecturer: Mrs Rohani Hassan
Chapter 4: Making Decisions.
Week#2 Day#1 Java Script Course
Chapter 4: Making Decisions.
Control Statement Examples
Tutorial 12 – Security Panel Application Introducing the Select Case Multiple-Selection Statement Outline Test-Driving the Security Panel Application.
Variables Lesson 3.
Validations and Error Handling
Selection CSCE 121 J. Michael Moore.
Escape sequences: Practice using the escape sequences on the code below to see what happens. Try this next code to help you understand the last two sequences.
Welcome back to Software Development!
Welcome back to Software Development!
JavaScript.
Chapter 3: Selection Structures: Making Decisions
CSCI N207 Data Analysis Using Spreadsheet
Programming Concepts and Database
CS2011 Introduction to Programming I Selections (I)
Chapter 3: Selection Structures: Making Decisions
Decisions, decisions, decisions
Welcome back to Software Development!
Variables Lesson 3.
True / False Variables.
This is an introduction to JavaScript using the examples found at the CIS17 website. In previous examples I specified language = Javascript, instead of.
Lesson 3. Controlling program flow. Loops. Methods. Arrays.
Switch Case Structures
Getting Started in Python
Module 3 Selection Structures 12/7/2019 CSE 1321 Module 3.
Presentation transcript:

Clear and Unclear Windows 1

Branching Statements

The if / else if / else branching statement if ( bool-expression ) { statement(s) } else

The if / else if / else branching statement if ( bool-expression1 ) { statement(s) } else if (bool-expression2 ) else

Your task… New project named branches Write a quick and simple calculator program: Display the message “If statement calculator…” Ask the user for a number (save it) Ask the user for a 2nd number (save it) Ask the user what math operation to do ( +, -, *, / ) Provide an error message if the user doesn’t enter a valid operator Use an if /else if /else to display the answer

The switch branching statement switch ( variable ) { case <option 1>: <code> break; case <option 2>: default: }

The switch branching statement switch ( variable ) { case <option 1>: <code> break; case <option 2>: default: } switch ( userName) { case “Korben Dallas”: Console.WriteLine(“LeeLoo loves you”); break; case “Zorg”: Console.WriteLine(“LeeLoo will destroy you”); default: Console.WriteLine(“Be careful!”); }

Your task continued… Create a new project named switch: Do the same thing again, write a simple calculator program Use a switch instead of an if Display the message “Switch statement calculator…”

Clear and Unclear Windows