{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

(23) - ICSI201 CHANGE YOUR CLICKER FREQUENCY Set your...

Info icon This preview shows pages 1–20. Sign up to view the full content.

View Full Document Right Arrow Icon
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
Image of page 1

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

View Full Document Right Arrow Icon
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
Image of page 2
CSI 201 Introduction to Computer Science [email protected] http://bls.its.albany.edu LI 95j
Image of page 3

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

View Full Document Right Arrow Icon
Lecture 23
Image of page 4
Administrivia
Image of page 5

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

View Full Document Right Arrow Icon
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.
Image of page 6
RESET CLICKERS TO FREQUENCY A B Administrivia – Reminders Labs Remember – bring your textbook to lab!
Image of page 7

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

View Full Document Right Arrow Icon
Today’s Content…
Image of page 8
Introduction to Media Computation
Image of page 9

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

View Full Document Right Arrow Icon
Two-Dimensional Arrays and Nested Loops
Image of page 10
This material corresponds to chapter five in the text. Manipulating Pictures, Arrays, and Loops
Image of page 11

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

View Full Document Right Arrow Icon
RESET CLICKERS TO FREQUENCY A B What makes a Good Method?
Image of page 12
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
Image of page 13

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

View Full Document Right Arrow Icon
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()
Image of page 14
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()
Image of page 15

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

View Full Document Right Arrow Icon
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
Image of page 16
Which line of code would cut the red value in half? A. adjustRGB(1.0, 1.0, 1.0) B. adjustRGB(1.0, 0.5, 1.0) C. adjustRGB(1.0, 1.0, 0.5) D. adjustRGB(0.5, 1.0, 1.0) E. None of the above RESET CLICKERS TO FREQUENCY A B
Image of page 17

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

View Full Document Right Arrow Icon
New decreaseRed() method public void decreaseRed() { adjustRGB(0.5, 1.0, 1.0); } RESET CLICKERS TO FREQUENCY A B
Image of page 18
RESET CLICKERS TO FREQUENCY A B What makes a Good Method?
Image of page 19

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

View Full Document Right Arrow Icon
Image of page 20
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern