Change Contents of the Bubble
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Homeworks-Spring 2005

All homework are due by 10 pm on the due date!

HW1: Implement one new image method in Picture


Create a new method in the class Picture that implements some kind of image manipulation. The picture that gets manipulated should be the target that receives the method (i.e., this). For example, if you implement the method "mytweak()", then you'll use it on some picture somePicture.mytweak(), and you'll expect the picture somePicture to change. (Don't bother returning a DIFFERENT picture for this method.)

What manipulation that gets implemented is entirely up to you: Increasing blue while decreasing red, flipping vertically, posterizing, etc. You must implement something NOT already implemented in the class Picture. You can use the methods that are there as examples.

Turn your implementation of the class Picture via WebCT. Name your method something that makes sense for what it does. Put your method at the bottom of the class definition, with a comment before it indicating your name and what your method does.

Did you make an interesting picture with your first method? Please consider sharing it in the Gallery HW1: First picture method-Sp05

Ask Questions on HW1-Sp2005 here.


HW2: Create a Picture collage


Implement a class with a static public void main() method that, when executed, creates and shows a collage of pictures. You need to have one picture appear four times: The original time, then three other times with some image manipulation. You're welcome to add additional pictures if you'd like. Mirroring the canvas horizontally or vertically often improves the composition of the collage, but is not necessary.

Your method can call FileChooser.setMediaPath() and then use FileChooser.getMediaPath() to access pictures.

Turn in your PictureCollage class, any additional pictures that you add to your media folder to create your collage, and your Picture class if you end up adding any additional methods to it. Turn in via WebCT.

Please consider sharing your collage on the Gallery HW2: Picture collage-Sp05

Ask Questions on HW2-Sp2005 here.


HW3: Create an audio collage


Create a collage of audio pieces, in the MediaSources, or those that you create. You must use at least five sounds. The overall result must be at least ten seconds long.

There must be a pattern to your collage. You could have one set of sounds that you call A, and another that you call B. Your collage may have a pattern of ABABAB, or AABBAB, or BBAABBBB. It's your call, but there should be a discernible audio pattern – visible in the code, and obvious to the ear.

Implement your collage in an AudioCollage class (that uses FileChooser.getMediaPath to access all media) in a main method. At the end of your main method, .play your song. (Optionally, you may also .write out your collage, in order to share it on the gallery, but please, remove the .write call before you turn it in.)

Turn in your AudioCollage Java file and any additional .WAV files you create and use via WebCT. Comments are important here! Include comments with:
  1. Your name and GT-email address
  2. Explaining what you're doing – help your TA figure out what's going on!

Please consider sharing your song in the Gallery HW3: An Audio Collage-Sp05

Ask Questions on HW3-Sp2005 here.


HW4: Use Weaving and Repeating to Create Music


Using the methods developed in class to play with linked list of music, create a song.

You only have to use SongNode and have a single part with a single instrument.
For +5 points extra credit, use the SongPart class and create your song with more than one part and instrument.

You will create a class (with some cunning name like MySong) with a main that will assemble your song, then open it with showFromMeOn. (If you use Song and SongPart, you'll use show instead of showFromMeOn.) Please put comments in your class:
  1. With your name, GT-email address
  2. Explaining what you're doing

Turn in to WebCT:

Please consider sharing your song (by saving out the MIDI) in the Gallery HW4: Woven Music-Sp05

Ask Questions on HW4-Sp2005 here.


HW5: Weave and replace with pictures


Using any of the linked lists of pictures that we created (where ordering represented linearity, or layering, or using turtles to walk the list), implement two additional methods:

You may find it easier to use these versions of PictNode.java, Picture.java, and SimplePicture.java – they have some additional accessors. You don't HAVE to use these versions, but you are welcome to! To use them:

SimplePicture.java


Picture.java


PictNode.java


You must also provide a class named PictureTest that has a main() method which utilizes your new methods. When the grader executes the main(), it should (a) show a background with three or more pictures in it, (b) then show a new picture after weaving a new element into it, and (c) finally a third picture with a replacement of one picture with another.

Please put comments in your class before each of the methods that you create:
  1. With your name, GT-email address
  2. Explaining what you're doing:

Turn in to WebCT:

Ask Questions on HW5-Sp2005 here.


HW6: Create an animation with sound effects


Note: This is a big program. Don't leave it for the last minute!

Create an animation with sounds associated with frames.

Here's how to do it:

You can use and modify any of the data structures that we've described in class.

You will also need to create a class (maybe AnimationRunner?). Your TA will create an instance of this class (AnimationRunner ar = new AnimationRunner()).

Please put comments in your classes and before each of the methods that you create:
  1. With your name, GT-email address
  2. Explaining what you're doing

Turn in to WebCT:

If you send me (Mark Guzdial) your files when you're done, I'll create a movie from your animation and post it at Gallery HW6: Animation with sound-Sp05. If you want to do it yourself, here's one way of doing it:

Ask Questions on HW6-Sp2005 here.


HW7: Build a Graphical User Interface (GUI) for REMOVEDging a Picture


Build a class named PictureTool whose constructor takes in a filename as input. You'll use it like this:
Welcome to DrJava.
> PictureTool pt = new PictureTool("D:/cs1316/mediasources/swan.jpg");


You should then (a) make a picture from that filename, (b) open it, and (c) (here's the part that you work at!) open a window with "Tools" in it. These tools should be buttons that will manipulate the picture. It'll look something like this:
Uploaded Image: HW7-smaller.jpg

You get to choose what tools that you provide, but there must be at least four:
  1. Provide some tool for manipulating the color: Reduce red, increase red, make it grayscale, make it negative, darken, or lighten. Your choice. (You can provide more than one – maybe lighten and darken?)
  2. Provide a tool that takes a numeric input and uses that input to manipulate the picture. Maybe it's a scaling tool and the input is amount to scale (2.0? 0.5?)? Maybe it's an amount to increase or decrease red?
  3. Provide a tool to do some kind of mirroring, either horizontal or vertical.
  4. One other tool of any kind you want. Flip? Red eye removal? Compose a Bratz doll scaled down into the bottom? Chromakey the picture into a jungle?

Everytime that we click one of these tools, the picture should be manipulated and then repainted! We want to see the change after clicking the tool.


Hint: If you need to convert the String from a text field into a Double (with a floating point, like for scaling), you can use Double.parseDouble(String) like this:
> Double.parseDouble("3.45")
3.45


Tip: If for the 'numeric input' part of this assignment you plan to implement scaling, you might benefit from my versions of these 2 files:
SimplePicture.java (rename to SimplePicture.java when you download)
PictureFrame.java

I added a close() method which means you can do
  Picture p = new Picture("..."); //make initial picture
  p.show();  //show it
  [....]
  //later on, in ActionListener of a button,
  Picture temp = p.scale(0.5);  //scale the original picture and store this result in temp
  p.close();  //close original p
  p = temp; //set p = temp
  p.show(); //show new p

#4


You must also provide a "Save" button that should save the resultant picture back onto the original filename. (Suggestion: Only do this on COPIES of pictures that you want to manipulate!)

Please put comments in your classes and before each of the methods that you create:
  1. With your name, GT-email address
  2. Explaining what you're doing

Turn in to WebCT:

Ask Questions on HW7-Sp2005 here.



HW8: Simulate immigration into another country


Using the Simulation Package developed in class, create a simulation of immigration behavior.

Setup

When running
Let's consider a timestep to be about a month. Run the simulation for 10 years (120 timesteps). Here are the starting (amazingly simplistic) rules.

Experimentation
You need to build Agent and Simulation subclasses to implement this scenario. But you have to explore and try different things in your simulation.

Things that you might want to try changing in your rules:
OvercrowdingMaybe there are more people to start with, or it takes more near neighbors to convince someone that they're overcrowded, or more timesteps of crowded conditions to convince them to move
Crop failuresWhat if crop failures were more common, or it took multiple consecutive crop failures to convince someone to emigrate.
TravelWhat if people didn't die on the trip over, or if it took longer
MovementWhat if people moved more often, or further, in either America or Europe.
DiseaseIn America, it was more likely crowded conditions that led to disease. What if people moved like they do in Europe, and they all came ashore at the same 2 or 3 spots, and then the incidence of disease was dependent on the number of people around you?

In addition to your program, you are to produce a Word file with graphs of all NINE of your runs – that's three runs of each of three sets of variables. Show all three variables – Europeans, in-transit, and Americans per timestep for all three of the scenarios that you explored. Explain what you changed in each scenario and why you think the results differed from the other scenarios.

Generate this simulation as a series of JPEG frames, so that we can create a movie from them! You can upload your movies to Gallery HW8: American Emigration-Sp05

Please put comments in your classes and before each of the methods that you create:
  1. With your name, GT-email address
  2. Explaining what you're doing

Turn in to WebCT:
Ask Questions on HW8-Sp2005 here.

EXTRA CREDIT: You can get +5 extra credit points for adding the additional variables of wealth and cost to the simulation and coming up with reasonable rules for how this wealth is used in the simulation. Europeans have a normal distribution of wealth, but the least wealthy are more likely to get sick, more likely to have crop failure, and are more likely to want to emigrate. The most wealthy are the least likely to want to emigrate, are less likely to have crop failure, and are less likely to get sick. Once in America, wealth still plays a factor (most of the Founding Fathers were quite wealthy by their standards). Wealth plays less of a role in movement, but still plays a role in whether you get sick and die. If you decide to go for the extra credit points, please explain what rules you implemented and why – and you still have to explore

HW9: Simulate a crowd scene


Using the simulation package developed in class, and replacing the turtle with character images, create a crowd scene simulation.

SetUp

During the Simulation
Let's imagine that a time step is a minute. Run the simulation for 90 minutes.

Generate this simulation as a series of JPEG frames, so that we can create a movie from them! You can upload your movies to Gallery HW9: Crowd Scene Movies-Sp05

Please put comments in your classes and before each of the methods that you create:
  1. With your name, GT-email address
  2. Explaining what you're doing

Turn in to WebCT:

EXTRA CREDIT: There is no requirement to have different types of villagers, but I'll offer up to 10 points extra credit for having three or more types (e.g., maybe 5 points for two types.) ! Mark Guzdial

Ask Questions on HW9-Sp2005 here.

Links to this Page