Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/http://creativecommons.org/licenses/by-nc-

Slides:



Advertisements
Similar presentations
ManipulatingPictures-Mod6-part21 Manipulating Pictures, Arrays, and Loops part 2 Barb Ericson Georgia Institute of Technology.
Advertisements

Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Georgia Institute of Technology Manipulating Pictures, Arrays, and Loops part 1.
Peer Instruction for the First Time: Experiences of a First Time User in Computer Science Beth Simon Computer Science and Engineering University of California,
Introduction to Computers and Programming Lecture 9: For Loops New York University.
Workshop on Peer Instruction: Making Good Clicker Questions Beth Simon Computer Science and Engineering University of California, San Diego Credits: Sara.
Comp 14 (3) By Stephan Sherman Office hours, W, 3:00-3:50pm.
1 Lecture Today’s topic Arrays Reading for this Lecture: –Chaper 11.
CS 106 Introduction to Computer Science I 02 / 28 / 2007 Instructor: Michael Eckmann.
CSE 8A Lecture 8 Reading for next class: None Prepare for In-term exam 2 PSA4: Collage and Picture Flip, DON’T WAIT (it’s longer than the previous PSAs)
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Words of Wisdom from the exiting 239 students Spring 2008 to the entering 139 students Fall 2008.
CSE8A Lecture3 TODO: –Finish PSA1 individually (no partner!) and turn it in with the bundlePSA1 command GET AN INTERVIEW for PSA1 from a tutor See tutor.
ManipulatingPictures-part11 Manipulating Pictures, Arrays, and Loops part 1 Barb Ericson Georgia Institute of Technology Nov 2009.
Georgia Institute of Technology Movies part 5 Barb Ericson Georgia Institute of Technology April 2006.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Welcome to CS 115! Introduction to Programming. Class URL Write this down!
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Programming in Java Dr. M. Ahmadzadeh. Course Outline (subject to tiny changes) I will cover the following but not necessarily in this order. –Strings.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Georgia Institute of Technology Manipulating Pictures, Arrays, and Loops Barb Ericson Georgia Institute of Technology August 2005.
TOPIC 6 MODIFYING PICTURES USING LOOPS 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Programming Classes: Getting Help Dr. Ralph D. Westfall March, 2011.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
CPSC1301 Computer Science 1 Chapter 4 Manipulating Pictures, Arrays, and Loops part 5.
CPSC 217 T03 Week VI Part #2: Midterm Review Session Hubert (Sathaporn) Hu.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Chapter 9 Control Structures.
Week 10 - Wednesday.  What did we talk about last time?  Method example  Roulette simulation  Types in Java.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
CSE8A Lecture 5 TODO: –FINISH PSA2 WITH YOUR PARTNER! Read next class: Section 5.1. PLAY WITH CODE! –Get stuck, then figure out how to get unstuck – it’s.
ManipulatingPictures-part31 Manipulating Pictures, Arrays, and Loops part 3 Barb Ericson Georgia Institute of Technology Nov 2009.
04-ManipulatingPictures-part21 Manipulating Pictures, Arrays, and Loops part 2 Barb Ericson Georgia Institute of Technology June 2008.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
COMP 110 Augustus Gloop, Augustus Gloop… Luv Kohli September 24, 2008 MWF 2-2:50 pm Sitterson 014.
Barbara Ericson Georgia Tech Sept 2005
Chapter 9 Repetition.
Manipulating Pictures, Arrays, and Loops part 2
Manipulating Pictures, Arrays, and Loops part 2
Topic 6 Modifying Pictures Using Loops
Creative Commons Attribution Non-Commercial Share Alike License
Manipulating Pictures, Arrays, and Loops part 3
Testing and Debugging.
Chapter 5 Repetition.
Manipulating Pictures, Arrays, and Loops part 2
Manipulating Pictures, Arrays, and Loops part 2
Manipulating Pictures, Arrays, and Loops
Manipulating Pictures, Arrays, and Loops part 5
Chapter 9 Control Structures.
CSE 8A Lecture 6 Reading for next class:
Manipulating Pictures, Arrays, and Loops part 3
Creative Commons Attribution Non-Commercial Share Alike License
Manipulating Pictures, Arrays, and Loops
Manipulating Pictures, Arrays, and Loops
Creative Commons Attribution Non-Commercial Share Alike License
Creative Commons Attribution Non-Commercial Share Alike License
Introduction to Programming in MATLAB
Manipulating Pictures, Arrays, and Loops
For Tutors Introduce yourself.
LCC 6310 Computation as an Expressive Medium
Arrays Introduction to Arrays Reading for this Lecture:
Presentation transcript:

Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/ sa/3.0/ Original Developer: Beth Simon, 2009

CSE8A Lecture 8 Read next class: read pg Finish PSA2! Get an interview before Thurs! Take advantage of resources! –Tutors – talk to them about book, lecture, being a major, etc –TAs: Go to office hours –Come to my office hours! –Form study groups!

You may not be *really* understanding… Suggestions: –PLAY with code in the compiler. Ask yourself – what will happen if I change this variable value from 5 to 10? Why? Type in code from book and change it. But don’t just accept that you can type it in Do you know WHY greyScale works? Do you know WHY negative works? –Read the book WITH someone else in class. Talk after every page. Try to explain the text to the other person in your own words Don’t “just read” it and think, yeah I get that (you don’t) –Redo the clicker questions WITH someone else –Redo labs

By the end of today’s class you should be able to… LG16: REVIEW: Find bugs in code including: a common “empty loop” bug, using the “how many times does this statement get executed” analysis technique. LG17: Argue about the best location of a print statement to debug a problem with a loop. LG18: Apply knowledge of how people pass racketballs to swap values of variables LG20: Trace the execution of code through multiple method calls. LG19: Read and trace execution of a code with a for loop (using a single array of pixels).

REVIEW:DEBUGGING: How many times is each set of code executed? Pixel[] pixelArray = this.getPixels(); int value = 0; Pixel p = null; int index = 0; while (index < pixelArray.length); { value = pixelArray[index].getRed(); value = (int) (value * 0.5); pixelArray[index].setRed(value); index = index + 1; }

DEBUGGING: Where is the best place to put a print statement? Pixel[] pixelArray = this.getPixels(); int value = 0; Pixel p = null; int index = 0; while (index < pixelArray.length) { value = pixelArray[index].getRed(); value = (int) (value * 0.5); pixelArray[index].setRed(value); index = index + 1; }

DEBUGGING: This code should swap the red and blue components at each Pixel, what does it ACTUALLY do? A.It has a compiler error B.It sets the red value to be the same as blue C.It sets the blue value to be the same as red D.It really does swap Pixel[] pixelArray = this.getPixels(); int value = 0; int index = 0; while (index < pixelArray.length) { Pixel pix = pixelArray[index]; value = pix.getRed(); value = pix.getBlue(); pix.setRed(value); pixelArray[index].setBlue(value); index++; }

Building on What you Already Know: Swapping Values

Swapping: A better way Pixel[] pixelArray = this.getPixels(); int value = 0; int index = 0; while (index < pixelArray.length) { Pixel pix = pixelArray[index]; > index++; } value = pix.getRed(); pix.setRed(pix.getBlue()); pix.setBlue(value); value = pix.getRed(); pix.setBlue(pix.getRed()); pix.setRed(value); value = pix.getRed(); pix.setRed(value); pix.setBlue(pix.getRed()); value = pix.getRed(); pix.setBlue(value); pix.setRed(pix.getBlue()); Reminder: Handout code

Code Order of Execution There’s a lot of code in different places –Picture.java, Turtle.java –Lab2.java –PSA2A.java, PSA2B.java How does Java know which code to execute, when? –In what order are code statements executed? –See Handout.

What order are statements executed in*? A.A,B,C,D,E,F B.A,B,E,F,C,D C.A,E,F,C,D,B D.A,E,C,F,D,B E.None of the above