Homework #3: Picture Collage

Objectives

A Class in Java allows us to define the properties and behaviors that instances of that class have; these class instances are known as objects. Since a class is meant to provide the shared properties and behaviors of all objects of that class, we need to define them in such a way that they are applicable to all objects.

In this assignment, you will be rewriting and writing methods that are applicable to all objects. In homework #2, some of you defined methods that are really applicable only to one picture and not to all. Perhaps you did that because the authors of the book did this. For example, copyKatiesFace() is a method that copies just Katie's face to the current picture object, the method cannot be used to copy some part of any picture onto another, that is what we're after!. The authors did improve on this by providing a more general copyPictureTo() method. We will follow this lead and write methods that are generally applicable to all objects.Note: some of you have designed methods that are already generally applicable to all Picture objects, so you'll have very little to do to meet these requirements. Others will have to do more work as many of the methods written for assignment #1 dealt with one picture only -- like copyKatiesPicture(). I can help everyone during labs to determine the best course of action.

The objectives of this assignment are twofold. One, you must redefine existing methods so that every method is generally applicable to all objects (e.g. like copyPictureTo()). Second, you are to use the Turtle object to draw shapes you design on your collage. Remember that a Turtle object can draw on a Picture; some of you already did this in homework #1.

Problem

  1. Decide on what you want your Turtle to draw on the Picture. It should be different from what you had in homework #1. You can have your Turtle draw on the final collage or you can even have it draw on each of the pictures that you use to create your collage. Be sure to draw shapes of your own design -- e.g., drawing an octagon on its own does not satisfy the requirements. Be creative! Update You must make non-trivial use of loops to move the turtle -- e.g., see the questions in the sample midterm and the midterm.
  2. You are to write a Java program that will create a collage of pictures of people and/or animals. You must make at least one use of each of the following Picture methods: mirroring, rotation, edge detection, posterize by levels. You may use other Picture methods as you desired to create a pleasing result. The Java program will call the Picture methods to make changes to your pictures and then start copying them to a blank canvas (e.g. blank Picture object). The program will also create a Turtle object and call Turtle methods to draw on the pictures. Remember to write the final picture object to a file as you will be turning in this picture as part of your assignment.

Deliverables

You must submit the Java code via e-mail only. As usual, to submit your code electronically, send via e-mail the files Picture.java, your Java main program (call it what you like, as long as it's a good name), and the resulting image collage.

Collaborating

You may collaborate with one student from this class in order to satisfy the requirements from this assignment. Each student is required to create his/her own original collage and thus must be different from the collage created by the student whom you collaborate with. That is, you can help each other to create the collage but each of you need to submit different programs (step 3 above) that manipulate the pictures in different way to create your own unique collage and which use the Turtle to draw on the picture in a different way.

Notes

Programming Resources