COMP 14: Miscellaneous :) May 30, 2000 Nick Vallidis.

Slides:



Advertisements
Similar presentations
Introduction to C# Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
Advertisements

8-May-15 Additional control structures. 2 The if-else statement The if-else statement chooses which of two statements to execute The if-else statement.
5/17/ Programming Constructs... There are several types of programming constructs in JAVA. - If-else construct or ternary operator - while - do-while.
Week 9: Methods 1.  We have written lots of code so far  It has all been inside of the main() method  What about a big program?  The main() method.
10-Jun-15 Just Enough Java. Variables A variable is a “box” that holds data Every variable has a name Examples: name, age, address, isMarried Variables.
Chapter 6 Horstmann Programs that make decisions: the IF command.
COMP 14: switch, Developing Programs June 2, 2000 Nick Vallidis.
Additional control structures. The if-else statement The if-else statement chooses which of two statements to execute The if-else statement has the form:
16-Jun-15 Additional control structures. 2 The if-else statement The if-else statement chooses which of two statements to execute The if-else statement.
Introduction to Primitives. Overview Today we will discuss: –The eight primitive types, especially int and double –Declaring the types of variables –Operations.
Python (yay!) November 16, Unit 7. Recap We can store values in variables using an assignment statement >>>x = We can get input from the user using.
Introduction to Computers and Programming for Loops  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to.
COMP 14: Looping (part 2) May 31, 2000 Nick Vallidis.
If Statements Sections 1.25, Control Structures o All code thus far executes every line of code sequentially o We want to be able to repeat,
COMP 14 Introduction to Programming Mr. Joshua Stough February 28, 2005 Monday/Wednesday 11:00-12:15 Peabody Hall 218.
COMP 14: Control Flow: if, if-then May 26, 2000 Nick Vallidis.
COMP 14: Midterm Review June 8, 2000 Nick Vallidis.
COMP 110 Branching Statements and Boolean Expressions Tabitha Peck M.S. January 28, 2008 MWF 3-3:50 pm Philips
University of British Columbia CPSC 111, Intro to Computation Jan-Apr 2006 Tamara Munzner Conditionals II Lecture 11, Thu Feb
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
COMP 14: I/O and Boolean Expressions May 24, 2000 Nick Vallidis.
If statements Chapter 3. Selection Want to be able to do a statement sometimes, but not others if it is raining, wear a raincoat. Start first with how.
COMP 14: Primitive Data and Objects May 24, 2000 Nick Vallidis.
1 Interactive Applications (CLI) Interactive Applications Command Line Interfaces Project 1: Calculating BMI Example: Factoring the Solution Reading for.
11 Chapter 4 LOOPS AND FILES. 22 THE INCREMENT AND DECREMENT OPERATORS To increment a variable means to increase its value by one. To decrement a variable.
Python Control of Flow.
COMP More About Classes Yi Hong May 22, 2015.
Shorthand operators.
Lecture 10 Instructor: Craig Duckett. Assignment 2 Revision TONIGHT DUE TONIGHT Wednesday, August 5 th Assignment 3 NEXT DUE NEXT Monday, August 10 th.
Hello AP Computer Science!. What are some of the things that you have used computers for?
How to be a successful student
Flow of Control Java Programming Mrs. C. Furman January 5, 2009.
Arrays (Part 1) Computer Science Erwin High School Fall 2014.
Control Structures if else do while continue break switch case return for.
Basic Java Programming CSCI 392 Week Two. Stuff that is the same as C++ for loops and while loops for (int i=0; i
1 Operators and Expressions Instructor: Mainak Chaudhuri
Lecture 3 Decisions (Conditionals). One of the essential features of computer programs is their ability to make decisions. Like a train that changes tracks.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
1 BUILDING JAVA PROGRAMS CHAPTER 2 PRIMITIVE DATA AND DEFINITE LOOPS.
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 6: Object-Oriented Programming.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 5: Introduction to C: More Control Flow.
COMP 110 switch statements and while loops Luv Kohli September 10, 2008 MWF 2-2:50 pm Sitterson
COMP Flow of Control: Branching 1 Yi Hong May 19, 2015.
Anatomy.1 Anatomy of a Class & Terminology. Anatomy.2 The Plan Go over MoveTest.java from Big Java Basic coding conventions Review with GreeterTest.java.
Methods We write methods in our programs for many reasons:
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
1-Dec-15 Additional control structures. 2 The if-else statement The if-else statement chooses which of two statements to execute The if-else statement.
J AVA P ROGRAMMING 2 C H 03: C ONTROL STATEMENTS if, for loop (review) switch, while, do while break, continue Fall Java Programming.
The while-statement. Syntax and meaning of the while-statement The LOOP-CONTINUATION-CONDITION is a Boolean expression (exactly the same as in the condition.
Conditionals Opening Discussion zWhat did we talk about last class? zDo you have any questions about the assignment? zPass by value limitations.
The for loop.
COMP 110 Branching Statements and Boolean Expressions Luv Kohli September 8, 2008 MWF 2-2:50 pm Sitterson
COMP Loop Statements Yi Hong May 21, 2015.
Lecture 5: Methods Tami Meredith. Roadmap The new material this week is predominantly from Chapter 5 (and Section 6.2 on static ) You should try and read.
1 Flow of Control Chapter 5. 2 Objectives You will be able to: Use the Java "if" statement to control flow of control within your program.  Use the Java.
Chapter 7 Control Structures. Java has very flexible three looping mechanisms. You can use one of the following three loops:  while Loop  do...while.
Content Programming Overview The JVM A brief look at Structure – Class – Method – Statement Magic incantations – main() – output Coding a Dog Programming.
Content Programming Overview The JVM A brief look at Structure
CS0007: Introduction to Computer Programming
ALGORITHMS CONDITIONAL BRANCH CONTROL STRUCTURE
Introduction to programming in java
ECS10 10/10
LRobot Game.
PROGRAM FLOWCHART Selection Statements.
Additional control structures
Just Enough Java 17-May-19.
LCC 6310 Computation as an Expressive Medium
CISC101 Reminders Assignment 3 due today.
Methods/Functions.
Presentation transcript:

COMP 14: Miscellaneous :) May 30, 2000 Nick Vallidis

Announcements zI made some changes to the P2 assignment (only on hand-in and grading policy) zoutput printout -- It's ok to put the word document on the disk and not print it

Review zWhat is control flow? zWhat are the two types of statements that modify the flow of control?  How does an if statement work? if (condition) statement;

Review (cont.)  How does an if-else statement work?  What if we want to put more than one statement in an if or if-else ? if (condition) statement1; else statement2;

Replacement zWhat do I mean when I type something like ? yI mean that the whole string " " should be replaced by a variable name yExamples from your homework assignment: x" " turns into "Nick Vallidis" x" " turns into "May 30, 2000" zYou'll see other people do this...

Replacement zYou'll also see this done with italics zExamples: ycondition means use a boolean expression ystatement means replace with an actual Java statement

Indenting  Don't forget the way indenting works with if, if-else, and block statements  if : If (x > 255) System.out.println("x is a big 'un."); Indent here!

Indenting  if-else : If (x > 255) System.out.println("x is a big 'un."); else System.out.println("x ain't so big."); Indents here!

Indenting zBlock statements: { System.out.println("x is a big 'un."); System.out.println("x ain't so big."); } Indents here!

Indenting zThis includes class definitions and main! Public class Birthday { public static void main(String[] args) { System.out.println("Hi!"); } Indents here! Two indents here because we're inside 2 block statements

Examples/Exercises zNo homework tonight! (unless of course you'd like to read ahead. I mean you don't have to, but it would probably be a good idea. Sure, everyone deserves a break sometime, but you should be all energized since you just had a long weekend. You should be ready to work your heart out this week. But, hey, it's up to you.)