Spring08_PracticeFinalExam

# Spring08_PracticeFinalExam - CS1316 Spring 2008 Practice...

This preview shows pages 1–4. Sign up to view the full content.

CS1316 Spring 2008 Practice Exam Final NAME: ___________________________________ PRISM ID:_______________________________ 1 Part I: Random Generators and Picture Methods Using Math.random() or the Random class, construct a method to solve the following problem. Write a new method in AdvancedPicture that will randomly change the pixels of the AdvancedPicture . There is a 40% chance that the pixel will have the red value maximized. 20% chance for the green value. 15% chance for the blue value. 25% chance that all green, blue and red values are set to 0. (Hint: Max value is 255). public void randomizePixels() public void grayscale(){ Pixel[] pixels = this.getPixels(); for (int i = 0; i < pixels.length; i++){ int intensity = (int) ((pixel[i].getRed() + pixel[i].getGreen() + pixel[i].getBlue()) / 3); pixel[i].setColor(new Color(intensity,intensity,intensity)); } }

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

View Full Document
CS1316 Spring 2008 Practice Exam Final NAME: ___________________________________ PRISM ID:_______________________________ 3 Student.java StudentNode.java Write a new toString method in StudentList that contains no loops (while or for) and is recursive. (Hint: figure out what parameters the method needs to take in).

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/30/2010 for the course CS 1316 taught by Professor Staff during the Spring '08 term at Georgia Tech.

### Page1 / 14

Spring08_PracticeFinalExam - CS1316 Spring 2008 Practice...

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

View Full Document
Ask a homework question - tutors are online