Programming Concepts and Database

Slides:



Advertisements
Similar presentations
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
Advertisements

Chapter 3 Program Design And Branching Structures.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 4 Making Decisions in a Program.
PSEUDOCODE & FLOW CHART
Subject: Information Technology Grade: 10
 Control structures  Algorithm & flowchart  If statements  While statements.
9b. Column/Bar Charts CSCI N207 Data Analysis Using Spreadsheet Department of Computer and Information Science, IUPUI Lingma Acheson
Conditional Statements Introduction to Computing Science and Programming I.
CS107 Introduction to Computer Science Loops. Instructions Pseudocode Assign values to variables using basic arithmetic operations x = 3 y = x/10 z =
Designing Algorithms Csci 107 Lecture 3. Designing algorithms Last time –Pseudocode –Algorithm: computing the sum 1+2+…+n –Gauss formula for 1+2+…+n Today.
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
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;
The If/Else Statement, Boolean Flags, and Menus Page 180
Algorithms. Introduction Before writing a program: –Have a thorough understanding of the problem –Carefully plan an approach for solving it While writing.
CIS101 Introduction to Computing Week 12 Spring 2004.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
CSCI N201 Programming Concepts and Database 3 – Essence of Computing Lingma Acheson Department of Computer and Information Science, IUPUI.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
9c. Line Charts CSCI N207 Data Analysis Using Spreadsheet Department of Computer and Information Science, IUPUI Lingma Acheson
Pseudocode. Simple Program Design, Fourth Edition Chapter 2 2 Objectives In this chapter you will be able to: Introduce common words, keywords, and meaningful.
1 CSCI N201 Programming Concepts and Database 9 – Loops Lingma Acheson Department of Computer and Information Science, IUPUI.
Conditional Expression One of the most useful tools for processing information in an event procedure is a conditional expression. A conditional expression.
6c – Function Procedures Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Agenda Basic Logic Purpose if statement if / else statement
CSCI-100 Introduction to Computing
Intro to Nested Looping Intro to Computer Science CS1510 Dr. Sarah Diesburg.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
9e. Scatter Charts CSCI N207 Data Analysis Using Spreadsheet Department of Computer and Information Science, IUPUI Lingma Acheson
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
2d – CheckBox Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Basic Conditions. Challenge: ● Ask the user his/her name ● If it’s “Wally,” jeer him ● Pause video and try on your own.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
EGR 115 Introduction to Computing for Engineers Branching & Program Design – Part 3 Friday 03 Oct 2014 EGR 115 Introduction to Computing for Engineers.
8. DECISION STRUCTURES Rocky K. C. Chang October 18, 2015 (Adapted from John Zelle’s slides)
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 3 Decision Trees Conditionals.
5b – For Loops Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Dale Roberts Introduction to Java - Input, Program Control and Instantiation Dale Roberts, Lecturer Computer Science, IUPUI
 2003 Prentice Hall, Inc. All rights reserved. 1 Basic C++ Programming.
9d. Pie Charts CSCI N207 Data Analysis Using Spreadsheet Department of Computer and Information Science, IUPUI Lingma Acheson
5a – While Loops Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
INC 161 , CPE 100 Computer Programming
- Standard C Statements
Microsoft Visual Basic 2005 BASICS
1) C program development 2) Selection structure
3. Decision Structures Rocky K. C. Chang 19 September 2018
Selection Statements.
Chapter 5: Control Structure
Computer Science Core Concepts
Learning Intention I will learn about programming using selection (making choices) with one condition.
Chapter 3: Selection Structures: Making Decisions
CSCI N207 Data Analysis Using Spreadsheet
An Introduction to Linux
Life is Full of Alternatives
Logical Operators and While Loops
Understanding Conditions
CS2011 Introduction to Programming I Selections (I)
CSCI N207 Data Analysis Using Spreadsheet
2g – ComboBox Lingma Acheson CSCI N331 VB .NET Programming
Relational Operators.
7 – Variables, Input and Output
4 – History of Programming Languages
6 – Miracle And “Hello World”
Chapter 3: Selection Structures: Making Decisions
Dale Roberts, Lecturer IUPUI
Programming Concepts and Database
4a- If And Else Lingma Acheson CSCI N331 VB .NET Programming
4d – Program Design Lingma Acheson CSCI N331 VB .NET Programming
Intro to Programming (in JavaScript)
Presentation transcript:

Programming Concepts and Database CSCI N201 Programming Concepts and Database 8 – Conditions Lingma Acheson linglu@iupui.edu Department of Computer and Information Science, IUPUI

Task: Ask the user to input a required integer, and compare the input to the required integer. If it’s the same, output “You entered the right integer!” If not the same, no output. E.g. Comp: Please enter integer 9: User: 9 Comp: “You entered the right integer!”

Algorithm Design Pseudocode – a mixture of natural language with programming language to help in algorithm design. Algorithm design: - Start a new program - Create a new variable n1 - Prompt for user input “Please enter integer 9:” and store the input to n1 - Change n1 to integer - If n1=9, output “You entered the right integer!” - End the program

Using Miracle http://www.cs.iupui.edu/~aharris/MirJS.html Begin the If branch (Conditional => If branch) Give the two numbers or values to compare Give the comparison operator == Equals != Not Equal <= Less than or equal to >= Greater than or equal to < Less than > Greater than End the If branch (Conditional => End structure)

If Statement Checks a condition Begins a block of code If condition is true, executes all codes in block If condition is false, skips code block

Refine the Algorithm Pseudocode: - Start a new program - Create a new variable n1 - Prompt for user input “Please enter integer 9:” and store the input to n1 - Change n1 to integer - If n1==9, output “You entered the right integer!” - End if - End the program Using Miracle!

Else Branch If the user input is not 9, output “You entered a wrong integer!” Pseudocode: - Start a new program - Create a new variable n1 - Prompt for user input “Please enter integer 9:” and store the input to n1 - Change n1 to integer - If n1==9 output “You entered the right integer!” else output “You entered a wrong integer!” - End if - End the program

Else Clause Else is a useful addition to If statements. Else allows you to set up another block of code to execute if the condition is false Using Miracle!

Lab Create a program to compare two user inputs and output the comparison result. Extra 20 credit: Create a program to take two integers, ask the user to enter “+”, “-”, “*”, or “/”. Perform the correspondent maths operation and output the result to the user.