CS 140 - Lab 10 Instructions

In this lab you are going to practice rotating pictures left and right.

Objectives

  1. More practice with for-loops
  2. Experiment with new picture methods
  3. Develop methods to rotate pictures left and right.

Method

Part I - Rotating an image to the left

  1. Make a Lab10 program with a main method that shows a picture from the CS140 gallery folder. Choose a picture you have not used before. Or better yet find your own picture on the web and use it.
  2. Implement the rotateLeft method we did in lecture today and use it on your picture above and display it. In which class and file does this method go?
  3. Use the rotateLeft method on your example image and display it. In order to do this you need to create a new picture object of the appropriate height and width before you can call rotateLeft.
  4. Use the rotateLeft method to rotate an image 180 degrees.

Part II - Rotating an image to the right

  1. Develop a Picture method rotateRight that rotates an image 90 degrees to the right.
  2. Use your rotateRight method on an example pitcure from the gallery.

Extra Credit

  1. Develop a picture method flip that flips an image using the x axis as the hinge. Here's an example of what it means to flip an image.

    Here's the original bug picture.

    And here it is flipped.

  2. Use flip on an image. Is flipping an image the same as rotating by 180 degrees? Explain.

© Ed Harcourt