(23) - ICSI201 CHANGE YOUR CLICKER FREQUENCY • Set your clicker to frequency A B • See the back of your clicker for instructions • Do NOT

Info iconThis preview shows pages 1–18. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ICSI201 CHANGE YOUR CLICKER FREQUENCY • Set your clicker to frequency A B • See the back of your clicker for instructions • Do NOT turn your clicker off during class!! • Your votes will not register, if you forget to set your frequency RESET your clicker to frequency AB RESET CLICKERS TO FREQUENCY A B Which direction would the following code copy the array: A. Mirror top half to bottom B. Mirror bottom half to top C. Mirror left half to right D. Mirror right half to left E. None of the above y for (x = 0; x < width/2; x++); for (y = 0; y < height; y++) { myArr[width-x-1][y] = myArr[x][y]; } } x CSI 201 Introduction to Computer Science [email protected] http://bls.its.albany.edu LI 95j Lecture 23 Administrivia RESET CLICKERS TO FREQUENCY A B Administrivia – Program • Programming Assignment Four is available from the class web page. – It is due Monday, November 3 rd before midnight. RESET CLICKERS TO FREQUENCY A B Administrivia – Reminders • Labs • Remember – bring your textbook to lab! Today’s Content… Introduction to Media Computation Two-Dimensional Arrays and Nested Loops This material corresponds to chapter five in the text. Manipulating Pictures, Arrays, and Loops RESET CLICKERS TO FREQUENCY A B What makes a Good Method? RESET CLICKERS TO FREQUENCY A B What makes a Good Method? • Ideally, a method should do one and only one thing. – That is, accomplish some task. – The method shouldn’t have any non-obvious side effect • don’t generate output unless the purpose of the method is to generate output – Also, the name should tell you what the method does • In Java, usually that’s done by using verbNoun format – adjustRGB – changeRed – copyImage RESET CLICKERS TO FREQUENCY A B What makes a Good Method? • A method can call other methods to do some of its work – This is known as procedural decomposition . – In essence, farming out sub-problems for other methods to handle. • For example, – decreaseRed() Old decreaseRed() Method public void decreaseRed() { Pixel pixArray = this.getPixels(); Pixel pix = null; int index = 0; // loop through all the pixels while(index < pixArray.length) { // get the current pixel pix = pixArray[index]; // get the red value int value = pix.getRed(); // decrease the red value by half value = value / 2; // set the pixel's red color pix.setRed(value); // increment the index index = index + 1; } // end while } // end method decreaseRed() But we have an adjustRGB method… • adjustRGB accepts 3 double values • multiplies each color channel by its respective adjustment factor • so, if we want to rewrite decreaseRed() so that it just uses adjustRGB……. RESET CLICKERS TO FREQUENCY A B Which line of code would cut the red value in half?...
View Full Document

This note was uploaded on 01/17/2009 for the course CSI 201 taught by Professor Doanne during the Fall '08 term at SUNY Albany.

Page1 / 50

(23) - ICSI201 CHANGE YOUR CLICKER FREQUENCY • Set your clicker to frequency A B • See the back of your clicker for instructions • Do NOT

This preview shows document pages 1 - 18. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online