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

Homeworks-Fall 2006

All homework are due by 7 pm EDT on the due date! Homework Policy

HW1: Implement two new image methods in Picture


DUE DATE: Fri 1 Sept

Write two new methods in the class Picture that implement some kind of image manipulation.The two methods can not be the same. You must use a for loop in one method and a while loop in the other! 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, but do not make any calls to those existing methods to implement your new methods.

Turn in Picture.java file via WebCT. Name your methods something that makes sense for what it does and place those names in the top comments region of the Picture.java class definition. Place your methods at the bottom of the class definition, with a comment before it indicating your name and what your method does.

The TA grading this homework will compile your Picture.java file in DrJava and test it using the Interactions pane. They will create an instance of a Picture, execute each of your defined methods on that Picture object and show() the results.

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

Ask Questions on HW1-Fall06 here.



HW2: Create a Picture collage


DUE DATE: Friday 8 Sept.

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.

You must use a Turtle to do some of your drawing!!

Your method must use FileChooser.getMediaPath() to access pictures.

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

Comments are important here! Please include comments at the top of your class definition:
  1. With your name, GT-email address
  2. Explaining what you're doing – help your TA figure out what's going on!

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

Ask Questions on HW2-Fall2006 here.


HW3: Create a dance, complete with music


DUE DATE: Monday 18 Sep

Using Sampled Sounds and the Turtles, create a musical dance. Play music (sounds at least?) while the turtles move in patterns.

Implement your dance and sounds in a TurtleDance class in a main method.

Turn in your TurtleDance Java file 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 and dance in the Gallery HW3: Turtle Dance-Fall06.

Ask Questions on HW3-Fall2006 here.


HW4: Use Weaving and Repeating to Create Music


DUE DATE: Fri 29 Sept.

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.

You will create a class (with some cunning name like MyWovenSong) with a main that will assemble your song, then open it with showFromMeOn (or show–whatever you need to do open up the notation View on your masterpiece). 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-Spring06

Ask Questions on HW4-Fall2006 here.

HW5: New Picture List Manipulations


DUE DATE: REVISED due date! Wed 11 Oct

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 three additional methods (where firstpicturnodeinlist is a node, not actually a picture):


You must also provide a class named PictureTest that has a main() method which utilizes all three of 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 using replace, and (c) a third picture with some new pictures inserted after some element of the list, then (d) a final fourth picture after using findAndReplaceRepeat.

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-Fall2006 here.


HW6: Create an animation with sound effects


DUE DATE: Friday 27 October

You must write HW6 using Pair Programming. Announce your pair at Pairs Page-Fall 2006. Not working in a pair is a 10% score penalty (i.e., you lose one letter grade from the start.) Be sure to fill out pairProgrammersAgreement.pdf form and turn it in to your grading TA by Monday 30 October.

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

Create an animation with sounds associated with frames.
THERE MUST BE AT LEAST 20 FRAMES IN YOUR ANIMATION.

Here's how you need to do it:

You can use and modify any of the data structures that we've described in class. You can create new data structures if you'd like.

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

From here on, there are SEVERAL ways to handle the animation.
Here's one:

For 5 points extra credit, use both Sound play() and blockingPlay() in your animation play() – but NOTE that you still can't CREATE any new sounds in your animation play() method. All the sounds still have to be in some kind of linked list data structure before you get started.
We also offer up to 10 points extra credit for the animation which goes beyond our expectation.
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:

Consider posting your movie at Gallery HW6: Animation with sound-Fall06.

Ask Questions on HW6-Fall2006 here.

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


DUE DATE: Friday 17 Nov

You must write HW7 using Pair Programming. Announce your pair at Pairs Page-Fall 2006. Not working in a pair is a 20% score penalty (i.e., you lose two letter grades from the start.) Be sure to fill out pairProgrammersAgreement.pdf form and turn it in to your grading TA by Monday 20 November.

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 with "Tools" in it.
These tools should be buttons that will manipulate the picture. It'll look something like this:
Uploaded Image: HW7.jpg

You get to choose what tools that you provide, but there must be at least five:
  1. Provide two buttons for manipulating the color: Reduce red, increase red, make it grayscale, make it negative, darken, or lighten. Your choice.(You can provide more than two if you want.)
  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?
  5. Provide a text area for entering a filename, and a "Save" button that should save the resultant picture with the filename entered in the text area. (Suggestion: Only do this on COPIES of pictures that you want to manipulate!)

Every time that we click one of these tools, the picture should be manipulated and then the frame must be repainted! We want to see the change after clicking the tool. (Hint: Call freme.repaint() after manipulating the picture)


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



Extra Credit 15 pts:Provide Undo and Redo buttons. With these two buttons, you can always go back and forth when you don't like the change you made on the picture. You only need to support up to one level, so there's no need to use a dynamic data strucutre to implement this feature. Note:Redo button must be disabled until you click Undo button.

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

Turn in to WebCT: (Only one of you need to submit HW, but don't forget to put your partner's name and GT-email address in your comment.)

Last time, people wanted to show off their cool tools. Feel free to take a picture of your tool and share it here: Gallery HW7: Picture Tools-Fall06

Ask Questions on HW7-Fall2006 here.

HW8: Simulate an ecology around Wolves and Deer


DUE DATE: Wed 6 Dec

You must write HW8 using Pair Programming. Announce your pair at Pairs Page-Fall 2006. Not working in a pair is a 30% score penalty (i.e., you lose three letter grades from the start.) Be sure to fill out pairProgrammersAgreement.pdf form and turn it in to your grading TA by Monday 27 November.

Using the Simulation Package developed in class, create a simulation of an ecology.


You must use WolfAgent, DeerAgent, and CornAgent classes for this HW, and your simulation should extend the Simulation class. One point of this homework assignment is to learn how to use the simulation package.

It has come to our attention that one recitation told students to use Wolf, Deer, and Corn classes instead of WolfAgent, DeerAgent, and CornAgent classes. We really apologize to you for this misinformation. If you need help or have any question for this hw, please email us or come to our office hours and we'll be happy to help you.|


Setup

When running
Let's consider a timestep to be about a week. Run the simulation for 2 years (104 timesteps). Here are the starting rules.

Updated!
Note: If you do things correctly, the above parameters will give you a simulation that exhibits exponential growth of the corn and you probably won't be able to run the simulation for the full two years. That's OK. Try to adjust parameters of the simulation in order to get something that can run for two years. For example, start out with more deer, or with a larger smell range for corn. It is perfectly fine to submit three of your own rule sets.


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:
Initial countsShould there be more Corn, or fewer Deer? Would culling the herd help more survive? Would more Wolves create better equilibrium?
RangesShould Deer or Wolves smell only closer, or farther? Should they not be able to jump to Corn or Deer in a single time step?

For +5 Extra Credit: Implement male and female Deer. Every 12 weeks, the female Deer can become pregnant if there is a male Deer within smell range. (You decide if the female jumps to the male, or the male jumps to the female.) Pregnancy lasts for 6 weeks, during which time the female will die if she doesn't get corn every THREE timesteps. At the end of six weeks, a new Deer is produced (randomly selected gender).

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 – Wolves, Deer, and Corn 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: Ecosystem Simulation-Fall06

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-Fall2006 here.

[Optional Extra Credit Assignment]

HW9: Build a Graphical User Interface (GUI) for a Juke Box


DUE DATE: Fri 8 Dec

This assignment is worth up to 1 point on your final grade!. It is not necessary to do this assignment, and you are not allowed to work in a pair on this assignment.

Goal: Create a juke box or media player and focus on Doubly Linked Lists as well as GUI development.

Background: This assignment uses doubly linked lists, a data structure with both a "previous" and a
"next" element. This type of data structure can be used is applications such as video editors or our very
own JukeBox. Below is an image to help you understand the concept of the doubly linked list

DLL.JPG

Description:

You have been given the following classes:
DLLNode.java
DLLSoundNode.java
DLLSoundElement.java
DLLCollectableNode.java
JukeBox.java

You must download these files and put them into your java-source package. In the class JukeBox, you
are given an open() method that will currently open a raw template of what we want you to design.
You must complete the following methods:

setUp()
addSong()
playCurrent()
removeCurrentSong()

and then complete the addButtons() method which will add at least five of the following gui aspects (* You must implement this):

a) a play button - this button will invoke the playCurrent() method*
b) a previous button - this button will move to the previous song in the playlist (don't assume there is a previous song)*
c) a next button - this button will move to the next song in the playlist (don't assume there is a next song!)*
d) a song label - this label will display the song file or sound that is currently selected in the play list (don't forget you need to update the label on changes)
e) random button - this button will move to a random song in the playlist
f) a track label - this label will display the position of the song in the list
g) a next/previous label - this label will display the next and previous songs in the list

For these gui aspects, use one of the layouts(ex...flow layour,border layout) we have discussed in class.

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 HW9-Fall2006 here.


Links to this Page