Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/http://creativecommons.org/licenses/by-nc-"— Presentation transcript:

1 Creative Commons Attribution Non-Commercial Share Alike License http://creativecommons.org/licenses/by-nc- sa/3.0/http://creativecommons.org/licenses/by-nc- sa/3.0/ Original Developer: Beth Simon, 2009 bsimon@cs.ucsd.edu

2 CSE8A Lecture 13 Read next class: read pg 182-193 PSA4: Read the specification CAREFULLY –Draw out what you think PictureFlip should do FIRST –Understand the main program that “driver” the PictureFlip method – talk about how it works with others, tutors Discussion Section NOW in Center 214 Grade distributions are posted on moodle. –See how your score fits in with what others are getting –This class is NOT graded on a curve, it is based on meeting baseline mastery But you can still figure out if you “need to do something differently” from others

3 How do you think you are doing in this class? A.I think I’m on top of it! B.I think I’m getting most everything. C.I think I’m getting barely enough to keep up, but I’m pretty sure I’ll get it eventually D.I think I’m not understanding as much as I need to. E.I think I am really lost and I understand little of what is going on now.

4 Upcoming Events  Cisco Fest  Tues., 10/27, 5-7pm, CSE 1202  Blizzard Day @ Jacobs  Wed., 10/28, 11-12 & 12-1pm, CSE 1202  Salesforce.com Day @ Jacobs  Wed., 10/28, 5:30-7pm, CSE 1202  Yahoo! Day @ Jacobs  Thurs., 10/29, 3:30-4:30pm, CSE 1202 Information Sessions Free Food Prizes & Giveaways Internships Career Opportunities And More! www.jacobsschool.ucsd.edu/CAP Corporate Affiliates Program

5 By the end of today’s class you should be able to… LG25: Read, trace, and write code that performs a transformation over a restricted set of pixels (like a “box” of pixels). LG26: Read, trace and write a method that uses more than one Picture object (including where one Picture is the calling object). LG27: Modify a method to make it more “flexible” by replacing constants with parameters. LG29: Compare and contrast code which modifies pictures conditionally based on pixel index location, based on Color of the pixel or both. LG30: Write and read code that either loops over a subset of pixels, or loops over all pixels and controls changes to pixels with an if statement

6 Parameters: Better than constants Generally want code that will be “user controllable” –Like video games – hit “A” – shoot/jump Though the “hard codes” constants (40 3 100) a lot, we want to use VARIABLES controlled by PARAMETERS –This lets us re-use code like “cropping and pasting into a blank canvas” no matter what part of the source picture we want to crop and no matter where we want to PLACE it in the canvas.

7 public static void main(String[] args) { World w = new World(100,200); Turtle jose = new Turtle(10,20,w); int turnDegrees = 90; jose.turn(turnDegrees); } public class Turtle { public void turn(int foo) { for (int i = 0; i< foo; i++) { //Code to make the turtle turn one degree right }

8 Underline the values you would change into parameters and write a new method header public void copyKatiesXXX( ) { Pixel sPixel, tPixel = null; for (int sX = 40, tX = 100; sX < 110; sX++, tX++) { for (int sY = 350, tY = 100; sY < 400; sy++, tY++) { sPixel = sourcePic.getPixel(sX,sY); tPixel = this.getPixel(tX,tY); tPixel.setColor(sPixel.getColor(); }


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

Similar presentations


Ads by Google