CS 140 - Test 2 Study Guide

Make sure review the homework assignments, all of the labs we've done, and the examples we've written in class.

  1. Write a method named makeBlurry that animates filling in a picture with random colors at random locations within the picture. One way to do this is to go through every pixel and toss a coin on whether you should change it or not.
      String path = "T:/Harcourt/Fall2008/CS140/gallery/";
      Picture pic = new Picture(path + "bug.jpg");
      makeBlurry(pic);
      pic.repaint();
    
  2. Write a method flipHorizontal that flips a picture horizontally. For example, here is the bug flipped horizontally. (Contrast this with the original.)
  3. Write a method rotateLeft that rotates a picture ninety degrees counter clockwise. For example, here is the bug rotated left. (Contrast this with the original)
  4. Make sure all of your methods from class and the labs are in your Picture.java file and work properly so you can use them.
  5. Review the clock program.
  6. Review the steganography programs used for encrypting and decrypting messages.
  7. Write a method brighten that makes a picture brighter by a percentage passed to it. For example brighten(pic,.1); will brighten pic by ten percent. To brighten a picture simply increase all three red, green, and blue values by the same amount. What you have to watch out for is having one of the color values become greater than 255. If a number becomes greater than 255 you should have it max out at 255.
  8. Review the copyInto, enlarge, grayscale, decreaseRed, and shrink methods.