Introduction to Application Programming

Slides:



Advertisements
Similar presentations
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Advertisements

Introduction to Java 2 Programming Lecture 5 Array and Collections.
Repetition Statements Perform the same task repeatedly Allow the computer to do the tedious, boring things.
Chapter 4 Ch 1 – Introduction to Computers and Java Flow of Control Loops 1.
For(int i = 1; i
Introduction to Computer Science Robert Sedgewick and Kevin Wayne Recursive Factorial Demo pubic class Factorial {
Introduction to Programming Lecture 15. In Today’s Lecture Pointers and Arrays Manipulations Pointers and Arrays Manipulations Pointers Expression Pointers.
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu.
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
CS150 Introduction to Computer Science 1
CS Data Structures Appendix 1 How to transfer a simple loop- expression to a recursive function (factorial calculation)
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Intro to Java while loops pseudocode. 1 A “Loop” A simple but powerful mechanism for “making lots of things happen!” Performs a statement (or block) over.
S A B D C T = 0 S gets message from above and sends messages to A, C and D S.
1 10/9/06CS150 Introduction to Computer Science 1 for Loops.
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
Loops Programming. COMP104 Lecture 9 / Slide 2 Shortcut Assignment l C++ has a set of operators for applying an operation to a variable and then storing.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
The for-statement. Different loop-statements in Java Java provides 3 types of loop-statements: 1. The for-statement 2. The while-statement 3. The do-while-statement.
Intro-Sound-part21 Introduction to Processing Digital Sounds part 2 Barb Ericson Georgia Institute of Technology Oct 2009.
COMPE 111 Introduction to Computer Engineering Programming in Python Atılım University
* What kind of loop would I use to complete the following: A. Output all of the prime numbers that are less than 100,000 B. Output the Fibonacci sequence.
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
CSC 204 Programming I Loop I The while statement.
Chapter 5 Control Structures: Loops 5.1 The while Loop The while loop is probably the most frequently used loop construct. The while loop is a conditional.
1 CS 1430: Programming in C++. 2 Input: Input ends with -1 Sentinel-Controlled Loop Input: Input begins with.
computer
 2003 Prentice Hall, Inc. All rights reserved. 1 Arrays Outline Introduction Arrays Declaring Arrays Examples Using Arrays.
Introduction to Computing Concepts Note Set 15. JOptionPane.showMessageDialog Message Dialog Allows you to give a brief message to the user Can be used.
CSI 1390: Introduction to Computers TA: Tapu Kumar Ghose Office: STE 5014 Office hours: Thursday 1300 – 1400hrs.
Introduction to Computational Modeling of Social Systems Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49,
pictures_slideshow/article.htm.
1 CSC103: Introduction to Computer and Programming Lecture No 16.
6.2 Classes “ A class is basically a structure with member functions as well as member data. Classes are central to the programming methodology known as.
How the Internet Works Most people use the internet but do not know how it works.
A Brief Introduction to Recursion. Recursion Recursive methods … –methods that call themselves! –They can only solve a base case –So, you divide a problem.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
© Janice Regan, CMPT 128, Jan CMPT 128: Introduction to Computing Science for Engineering Students, continue; and break; statements.
Decisions: Conditional Statements (informally called If Statements) IST 256 Application Programming for Information Systems.
1 CSC103: Introduction to Computer and Programming Lecture No 9.
Web Programming: Loop Xiaozhong Liu
CSC111 Quick Revision.
Web Programming: If Statement and Servlet
Practice + Method Xiaozhong Liu
MIS Professor Sandvig MIS 324 Professor Sandvig
facebook Character Name Wall Photos Flair Boxes Name Logout Wall Info
Incrementing ITP © Ron Poet Lecture 8.
String operations; More on function definitions; Conditional execution
JavaScript conditional
Introduction to Processing Digital Sounds part 2
PHP: Basics FdSc Module 109 Server side scripting and Database design
Chapter 4 Writing Classes.
Repetition Control Structure
Programming Fundamentals
The Big 6 Research Model Step 3: Location and Access
Introduction to Computer Science
Reminder: Unit 1 Test – Monday
Main() { int fact; fact = Factorial(4); } main fact.
CSE 1020:Software Development
Lec 6 Loop Statements Introduction to Computer Programming
Unit-1 Introduction to Java

Presentation transcript:

Introduction to Application Programming https://xliu12.mysite.syr.edu/ Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu

Mario player = new Mario(); //hit a special brick Mario problem http://www.pouetpu-games.com/index.php?section=2&game_id=1&w=640&h=480 Mario player = new Mario(); //hit a special brick if (player.status.equals(“small”)) { show_mushroom(); } else { show_flower();

Mario problem Mario player = new Mario(); //Mario change if (get_mushroom()) { player.status = “big”; } if (get_flower()){ player.status = “shoot”; if (get_hurt() && player.status.equals(“big”)) { player.status = “small”; if (get_hurt() && player.status.equals(“small”)) { player.status = “die”;

Example 1 If your age > 20, serve you wine; else, serve you soda… int age; String drink; age = ??; if (age > 20) { drink = “wine”; } else { drink = “soda”; System.out.println(drink);

System.out.println(result); Sum of: 1 + 2 + 3 + 4 + 5 + 6 +……….. + 100 int result = 0; result = result + 1; result = result + 2; result = result + 3; …… result = result + 100; System.out.println(result);

for (int i = 0; i <= 100; i = i + 1) { result = result + i; } Sum of: 1 + 2 + 3 + 4 + 5 + 6 +……….. + 100 int result; result = 0; for (int i = 0; i <= 100; i = i + 1) { result = result + i; } System.out.println(result);

Example int i = 1 result = result + i; i ++ yes i <= 100? no Initialization int i = 1 Loop Body Increment result = result + i; i ++ yes Condition? yes i <= 100? no no

result = result + number; } System.out.println(number); Sum of: 1 + 2 + 3 + 4 + 5 + 6 +……….. + ??? Result more than 1000 int result = 0; int number = 0; while (result < 1000) { number = number + 1; result = result + number; } System.out.println(number);

Compare for (int i = 0; i <= 100; i = i + 1) { result = result + i; } while (result < 1000) { number = number + 1; result = result + number; }

For or While? Compute 25! (factorial) 2. Save $1000 in the bank, interest rate is 3.5%. How many years total = $1800 3. Send messages to your facebook friends automatically