Java and Media Library Version Requirements
Your programs must be compatible with Sun's Standard Edition JDK Version 1.7 or later.
Some of the programs on this test require you to use the Guzdial-Ericson multimedia class library. You will find download, installation, and usage instructions for the library at Java OOP: The Guzdial-Ericson Multimedia Class Library .
Input Image Files
Links are provided within the individual program specifications for downloading zip files that contain any image files that may be required to write, compile, and test your programs.
Solution source code files
The downloadable zip files mentioned above also contains source code files for the programming solutions. You can compile and execute those programs using procedures described in Java OOP: The Guzdial-Ericson Multimedia Class Library .
Output Images
Your output image(s) must match my output image(s) in every respect including color, size, position, etc. Don't forget to display your name in the output image(s) as shown.
New Classes
You may define new classes and add import directives as needed to cause your programs to behave as required, but you may not modify the class definitions for the given classes named ProbXX when such class definitions are provided.
Hints
For some of the programs, you may first need to deduce the algorithm used to transform the input image into the output image, and then write a working program that implements that algorithm. In some cases, you may need to compare numeric color values for corresponding pixels in the input and output images in order to deduce the algorithm.
You can obtain those color values using the following procedure:
- Click the download link for the zip files that contain input image files and solution source code files. Use the capabilities of your browser to download and save the contents of those zip files.
- If necessary, replace calls to the show method in my source code with calls to the explore method to force the program to display the output images in a PictureExplorer window.
- Compile and run the source code.
- Write, compile, and run a simple Java program that will display each input image file in a PictureExplorer window.
- Use the input and output PictureExplorer windows to compare the input and output color values on a pixel by pixel basis.
You may find other useful hints in my online tutorials and slides for this course.
Testing Your Programs
You can compile and execute your program by following the instructions given at Java OOP: The Guzdial-Ericson Multimedia Class Library .
Program Specifications
Program 1
Listing 1: Write the Java application described below.
/*File Prob01 Copyright 2012 R.G.Baldwin
Write a program named Prob01 that uses the class definition shown below and Ericson's media library along with the image file named Prob01.jpg to produce the graphic output image shown in Figure 1 below.
Click here to download a zip file containing the required image file along with the source code for a solution.
Contrary to the general instructions given above, you may not define any new classes to cause your program to behave as required.
You must copy and modify (if necessary) the media classes named World.java, Turtle.java, and SimpleTurtle.java to cause your program to produce the required output. Don't forget to compile these classes after you modify them.
In addition to the output image, your program must produce the following output on the command- line screen, and must substitute your name for mine wherever my name appears both in the image and on the command-line screen:
Dick Baldwin
Picture, filename Prob01.jpg height 274 width 365
Dick Baldwin
Dick Baldwin
Dick Baldwin
Dick Baldwin
*********************************************************/
public class Prob01{
//DO NOT MODIFY THE CODE IN THIS CLASS DEFINITION.
public static void main(String[] args){
World mars = new World(200,250);
Turtle joe = new Turtle(mars);
joe.forward();
Turtle bill = new Turtle(mars);
bill.moveTo(50,125);
Turtle sue = new Turtle(mars);
sue.moveTo(150,125);
Turtle tom = new Turtle(mars);
tom.moveTo(100,225);
}//end main method
}//end class Prob01
//End program specifications.| Required output images for Prob01. |
|---|
![]() |
Program 2
Listing 2: Write the Java application described below.
/*File Prob02 Copyright 2012 R.G.Baldwin
Write a program named Prob02 that uses the class definition shown below and Ericson's media library to produce the graphic output image shown in Figure 2 below.
Click here to download a zip file containing source code for a solution.
Contrary to the general instructions given above, you may not define any new classes to cause your program to behave as required.
You must copy and modify (if necessary) the media classes named Turtle.java, and SimpleTurtle.java to cause your program to produce the required output. Don't forget to compile these classes after you modify them.
In addition to the output image, your program must produce the following output on the command- line screen, and must substitute your name for mine wherever my name appears both in the image and on the command-line screen:
Dick Baldwin
My name is Joe the turtle.
*********************************************************/
import java.awt.Color;
public class Prob02{
//DO NOT MODIFY THE CODE IN THIS CLASS DEFINITION.
public static void main(String[] args){
World mars = new World(200,300);
Turtle joe = new Turtle(mars,"Joe");
joe.moveTo(20,280);
joe.setInfoColor(Color.WHITE);
joe.setShowInfo(true);
System.out.println(joe);
}//end main method
}//end class Prob02
//End program specifications.| Required output images for Prob02. |
|---|
![]() |
Program 3
Listing 3: Write the Java application described below.
/*File Prob03 Copyright 2012 R.G.Baldwin
Write a program named Prob03 that uses Ericson's media library to produce the graphic output images shown in Figure 3 and Figure 4 below.
Click here to download a zip file containing the source code for a solution.
The image shown in Figure 3 is the image that appears on the screen when the program starts running. The image shown in Figure 4 is what you should see when you click the button at the bottom of the world.
You must copy and modify (if necessary) the media class named World.java, to cause your program to produce the required output with the required behavior. Don't forget to compile that class after you modify it.
This program adds a JButton object to the SOUTH location of the World object as shown in Figure 3 .
The program initially displays an empty white world. When the user clicks the button, the world's background color changes to blue, a turtle appears in the center of the World, and the student's name appears near the top of the world.
| The first of two required output images for Prob03. |
|---|
![]() |
| The second of two required output images for Prob03. |
|---|
![]() |
Program 4
Listing 4: Write the Java application described below.
/*File Prob04 Copyright 2012 R.G.Baldwin
Write a program named Prob04 that uses Ericson's media library to produce the graphic output images shown in Figure 5 , Figure 6 , and Figure 7 below.
Click here to download a zip file containing the source code for a solution.
Figure 5 shows the image that appears on the screen when the program starts running. Figure 6 shows what you should see after you have clicked the button at the bottom of the world one time. Figure 6 shows what you should see after you have clicked the button sixteen times.
You must copy and modify the media classes named World.java and SimplePicture.java, to cause your program to produce the required output with the required behavior. Don't forget to compile those classes after you modify them.
This program adds a JButton object to the SOUTH location of the World object as shown in Figure 5 .
The following description is intended to guide you in writing your program. However, you must run my version of the program and replicate it exactly. I recommend that you run the two programs side-by-side and compare their appearance and behavior each time you click both programs.
The program initially displays an empty white world with a button at the bottom. When the user clicks the button, the world's background color changes to green, a turtle appears in the bottom right of the World, and the student's name appears near the top of the world in blue. The turtle has a blue body and a red shell.
When you click the button again, the background changes to yellow, the student's name changes to red, and the turtle changes to a red body with a blue shell. The turtle turns 90 degrees left and moves forward 100 pixels plus the value of a click counter. As a result, the turtle leaves a blue trail.
On the next click, the colors revert to the same as before, the turtle turns 90 degrees left and moves forward 100 pixels plus the value of the click counter leaving a red trail.
This cycle repeats on each click with the turtle's trail drawing a square spiral of increasing size with red lines on the top and bottom of the spiral and blue lines on the right and left of the spiral.
| Required output image for Prob04. |
|---|
![]() |
| Required output image for Prob04. |
|---|
![]() |
| Required output image for Prob04. |
|---|
![]() |
Program 5
Listing 5: Write the Java application described below.
/*File Prob05 Copyright 2012 R.G.Baldwin
Write a program named Prob05 that uses Ericson's media library to produce the graphic output image shown in Figure 8 , Figure 9 , and Figure 10 below.
Click here to download a zip file containing the source code for a solution.
Figure 8 shows the image that appears on the screen when the program starts running. Figure 9 shows what you should see after you have entered numeric values into the angle and distance fields and have clicked the Move button. Figure 10 is similar to what you should see after doing the above several times for different numeric values.
You must copy and modify the media class named World.java to cause your program to produce the required output with the required behavior. Don't forget to compile World.java after you modify it.
This program adds two buttons, two labels, and two text fields to form a GUI at the bottom of the World object.
If you enter numeric values into the angle and distance fields and then click the Move button, the turtle will turn by that angle in degrees and move by that distance in pixels.
The program must terminate and return control to the operating system when you click the Quit button.
Note that the GUI at the bottom of the World object is comprised of AWT components instead of Swing components.
| Required output image for Prob05. |
|---|
![]() |
| Required output image for Prob05. |
|---|
![]() |
| Required output image for Prob05. |
|---|
![]() |














