CSI Sample Final

CSI Sample Final - SAMPLE QUESTIONS FOR FINAL Introduction...

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

View Full Document Right Arrow Icon
QUESTION 1 Add full Javadoc compliant comments to the following method. For full credit, also add comments in the method to explain each block of code. public static Picture doesSomething(Picture p, Color c) { Picture b = new Picture(p.getWidth() + 20, p.getHeight() + 20); for(int x = 0; x < b.getWidth(); x++) for(int y = 0; y < b.getHeight(); y++) b.getPixel(x,y).setColor(c); for(int x = 0; x < p.getWidth(); x++) for(int y = 0; y < p.getHeight(); y++) b.getPixel(x+10,y+10).setColor(p.getPixel(x,y).getColor()); return b; } Introduction to Computer Science CSI201 Spring 2010 SAMPLE QUESTIONS FOR FINAL
Background image of page 1

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

View Full DocumentRight Arrow Icon
QUESTION 2 The following code outlines a method called randomColor(). This method should create and return a random color. Fill in code to make this happen. Any color (any RGB value) should be possible. You may assume that any required packages have been imported. public static Color randomColor() { Color c; // Your code begins here // Your code ends here return c; } Csi 201 - Sample Final - Spring 2010 Page 2
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/07/2011 for the course CSI 201 taught by Professor Doanne during the Spring '08 term at SUNY Albany.

Page1 / 6

CSI Sample Final - SAMPLE QUESTIONS FOR FINAL Introduction...

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

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