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

Slides:



Advertisements
Similar presentations
TOPIC 5 INTRODUCTION TO PICTURES 1 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B.
Advertisements

ManipulatingPictures-Mod6-part21 Manipulating Pictures, Arrays, and Loops part 2 Barb Ericson Georgia Institute of Technology.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Georgia Institute of Technology Manipulating Pictures, Arrays, and Loops part 1.
Week 6 - Programming I So far, we’ve looked at simple programming via “scripts” = programs of sequentially evaluated commands Today, extend features to:
ECE122 L11: For loops and Arrays March 8, 2007 ECE 122 Engineering Problem Solving with Java Lecture 11 For Loops and Arrays.
R-1 University of Washington Computer Programming I Lecture 17: Multidimensional Arrays © 2000 UW CSE.
1 CS1130 Spring 2011: David Gries & Walker White Transition to Object-Oriented Programming Assumes programming knowledge in a language like Matlab, C,
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/
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.
Pictures Looping through pixels.. Lab Review (1) Objects  Instantiated from Class  Turtle myTut = new Turtle(myWorld);  new operator creates an instance.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
CSE8A Lecture2 Check the class web page (and discussion board, linked form webpage) for news and info: cse8a.weebly.com Lab starts this week. Discussion.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Problem of the Day  Why are manhole covers round?
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
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/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
TOPIC 5 INTRODUCTION TO PICTURES 1 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
CPSC1301 Computer Science 1 Chapter 4 Manipulating Pictures, Arrays, and Loops part 5.
C Programming Lecture 16 Pointers. Pointers b A pointer is simply a variable that, like other variables, provides a name for a location (address) in memory.
LCC 6310 Computation as an Expressive Medium Lecture 2.
A First Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington Credits: a significant part of.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Building java programs, chapter 3 Parameters, Methods and Objects.
Structuring Data: Arrays ANSI-C. Representing multiple homogenous data Problem: Input: Desired output:
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
CSE 8A Lecture 13 Reading for next class: Chapter 9 Today’s topics: –Sounds! Finish PSA 6: Chromakey! DUE TUESDAY Interm exam 3 next Thursday.
CSE 8A Lecture 14 Reading for next class: None (INTERM EXAM #3) Today’s topics: –More Sounds! PSA 6 due tonight PSA 7 (sounds) due next Monday (11/19)
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
BIT 115: Introduction To Programming Professor: Dr. Baba Kofi Weusijana (say Doc-tor Way-oo-see-jah-nah, Doc-tor, or Bah-bah)
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.
1 Good Questions Spark discussion Motivate a topic Address a common misconception Help students “speak” in the language of your discipline Foster reflection.
Test Corrections On a separate sheet (not the original test), correct all your mistakes carefully. Hand both in, not stapled together. Do this work on.
1 Sections 3.1 – 3.2a Basic Syntax and Semantics Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Manipulating Pictures, Arrays, and Loops part 2
Manipulating Pictures, Arrays, and Loops part 2
Creative Commons Attribution Non-Commercial Share Alike License
Manipulating Pictures, Arrays, and Loops part 3
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
Looping through pixels.
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
Data Types and Expressions
Creative Commons Attribution Non-Commercial Share Alike License
Manipulating Pictures, Arrays, and Loops
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 5 TODO: –FINISH PSA1 WITH YOUR PARTNER! Expect to spend 6 hours! If you don’t have a partner, do this PSA on your own AND GET a partner on the discussion forum Read next class: pages , take the online reading quiz. Quiz Reflection: Group quiz PLAY WITH CODE! –Get stuck – it’s how you learn! CLICKERS OUT! LAPTOPS? “Stuck, stuck, stuck!” “I felt like a lost child when I first came in and tried this. But now I’m much more comfortable with how we’re supposed to be [learning].” --”A” Student from CSE8A 2008

By the end of today’s class you should be able to… LG9: Nest several method calls in one statement (in contrast to doing multiple assignments) LG10: Explain how bits (0s and 1s) in a computer’s memory can be interpreted in a variety of ways (depending on issues of type and representation) LG11: Use a for each loop in Java to loop over all pixels in a picture and perform a transformation on those pixels (e.g. decrease their red component). LG12: Apply Java syntax to cast a variable to another value (and explain how it’s useful in setting picture colors). LG13: Read and understand a while loop for modifying a Picture, including being able to draw a memory model of this code

CSE8A: Introduction to Programming in Java Chapter 4 (up to 89)

What does this data stored in a computer represent? A.Deep Red (a channel) B.White (all channels maximum) C.Black (all channels minimum) D.1 E.255 1)SOLO VOTE (60 sec) 2)Discuss (2 min) 3)Team VOTE (30 sec)

Advice: READING! There is very important information in the textbook you are responsible for knowing. –I won’t talk about all of it in class, if you CAN learn it from the reading In class, you’ll need to have LEARNED from the reading in order to learn effectively from the clicker questions! –Which emphasize the book material that is hard to learn

What is the difference between these codes? 1)Think SOLO (30 sec) 2)Discuss (2 min) 3)Type in answer on UP (30 sec) String fileName = FileChooser.pickAFile(); Picture picObj = new Picture(fileName); picObj.show(); Picture picObj = new Picture(FileChooser.pickAFile()); picObj.show(); A B

Chapter 2 review! What is stored in the variable name after the following line of code is executed? String name = "Bob"; A.“Bob” B.Bob C.The address in memory where “Bob” is stored D.new String(“Bob”) 1)Solo: (20 sec) 2)Discuss: (1 min) 3)Group: (20sec) In 2 slides help me apply this to a Pixel array!

What does this code do? A.Decreases the blue component of a picture B.Sets the green component of each pixel to be the same as the blue component C.Sets the blue component of each pixel to be the same as the green component D.Loops over all pixels in pixelArray. For each pO calls getGreen and stores that into value. Then sets value into blue. E.None of the above. Pixel[] pixelArray = this.getPixels(); int value = 0; for (Pixel pO: pixelArray) { value = pO.getGreen(); pO.setBlue(value); } 1)Solo: (45 sec) 2)Discuss: (1 min) 3)Group: (30 sec)

Pixel[] pixelArray = this.getPixels(); int value = 0; for (Pixel pO: pixelArray) { value = pO.getGreen(); pO.setBlue(value); }

Pixel[] pixelArray = this.getPixels(); int value = 0; Pixel pO = //first pixel in picture value = pO.getGreen(); pO.setBlue(value); pO = //next pixel in picture value = pO.getGreen(); pO.setBlue(value); pO = //next pixel in picture value = pO.getGreen(); pO.setBlue(value); pO = //next pixel in picture value = pO.getGreen(); pO.setBlue(value); pO = //next pixel in picture value = pO.getGreen(); pO.setBlue(value); pO = //next pixel in picture value = pO.getGreen(); pO.setBlue(value); pO = //next pixel in picture ON AND ON THROUGH ALL PIXELS IN PICTURE

Rules of Memory Model Drawing Two sections of memory (separate them somehow): –Simple memory: primitive type variable “boxes” with actual data in them Class/object variable “boxes” have an arrow in them to complex memory –Complex memory: class/object type ACTUAL DATA is stored here Declaration ; –Write down the name in the correct memory space –Class/object types actually have an empty box (will have arrow later) Instantiation/Assignment –Draw box (or multi-boxes if array) and fill in values Ok, we’re not writing in all the pixel values, but maybe some. Execution (sequential or loop) –If an assignment is made, change the value in the box on the left side of the assignment –If you need to evaluate an expression, read the values in the boxes to help.

Play with code! For example (from page 93): for (Pixel pixelObj : pixelArray) { //get the red value value = pixelObj.getRed(); //decrease the red value by 50% value = (int) (value * 0.5); //set the red value of the current pixel to new value pixelObj.setRed(value); }