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 in this group 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 any image files that may be required to write, compile, and test your programs.
Solution source code files
Links are provided within the individual program specifications for downloading source code files that contain 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.
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 on the input image file link(s) and use the capabilities of your browser to download and save the image file(s).
- Click on the Java solution source code link(s) and use the capabilities of your browser to download and save the source code file(s).
- 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.
- Write, compile, and execute 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.
In addition to the hints listed above, I will precede the detailed specifications for each program with a discussion that contains hints about the concepts and skills that you will probably need to successfully write the program.
In order to write this or any other Java program of substance, you will need to know how to use the Java Platform, Standard Edition API Specification as well as the documentation for the Guzdial-Ericson Multimedia Class Library .
You may find other useful hints in my online tutorials and slides for this course as well as in the YouTube video lectures 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
Discussion
The following is a non-exhaustive list of concepts that you need to understand along with knowledge and skills that you need to possess in order to successfully write this program and/or understand the given solution in Prob01.java . Some of these items are general in nature and some are specific to the use of Ericson's multimedia library. I won't repeat the items that were listed with the programs in Practice Group 1 . Instead, I will concentrate on new concepts, knowledge, and skills not included in previous lists.
- How to design and implement an algorithm that will transform the original image into the image shown in Figure 1 .
- How to instantiate an object and call a method on that object in a single statement .
- How methods belonging to an object call other methods belonging to the same object.
- How to call a method on an object to modify the object saving only a reference to the modified object.
- The use of nested loops to access and modify image pixels on the basis of the horizontal and vertical coordinates of the pixels.
- How to create a mirror image of a portion of an image about a vertical line in the image.
- How to create a mirror image of a portion of an image about a horizontal line in the image.
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 Prob01.java to download a Java source file containing the solution to this program.
In addition to the output image, your program must display your name and the other text shown below on the command-line screen:
Display your name here.
Picture, filename Prob01.jpg height 240 width 320
*********************************************************/
public class Prob01{
//DO NOT MODIFY THE CODE IN THIS CLASS DEFINITION.
public static void main(String[] args){
Picture pic = new Prob01Runner().run();
System.out.println(pic);
}//end main method
}//end class Prob01
//End program specifications.| Required output image for Prob01. |
|---|
![]() |
Program 2
Discussion
The following is a non-exhaustive list of concepts that you need to understand along with knowledge and skills that you need to possess in order to successfully write this program and/or understand the given solution in Prob02.java . Some of these items are general in nature and some are specific to the use of Ericson's multimedia library. I won't repeat the items that were listed with the programs in Practice Group 1 or earlier programs in this practice group. Instead, I will concentrate on new concepts, knowledge, and skills not included in previous lists.
- How to design and implement an algorithm that will transform Prob02a.jpg and Prob02b.jpg into the image shown in Figure 2 .
- How to flip an image around its center line.
- How to crop an image.
- How to copy one image onto another image.
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 along with the image files named Prob02a.jpg and Prob02b.jpg to produce the graphic output image shown in Figure 2 below.
Click Prob02.java to download a Java source file containing the solution to this program.
In addition to the output image, your program must display your name and the other text shown below on the command-line screen:
Display your name here.
Picture, filename Prob02a.jpg height 118 width 100
Picture, filename Prob02b.jpg height 240 width 320
Picture, filename None height 101 width 77
*********************************************************/
public class Prob02{
//DO NOT MODIFY THE CODE IN THIS CLASS DEFINITION.
public static void main(String[] args){
Picture[] pictures = new Prob02Runner().run();
System.out.println(pictures[0]);
System.out.println(pictures[1]);
System.out.println(pictures[2]);
}//end main method
}//end class Prob02
//End program specifications.| Required output image for Prob02. |
|---|
![]() |
Program 3
Discussion
The following is a non-exhaustive list of concepts that you need to understand along with knowledge and skills that you need to possess in order to successfully write this program and/or understand the given solution in Prob03.java . Some of these items are general in nature and some are specific to the use of Ericson's multimedia library. I won't repeat the items that were listed with the programs in Practice Group 1 or earlier programs in this practice group. Instead, I will concentrate on new concepts, knowledge, and skills not included in previous lists.
- How to design and implement an algorithm that will transform Prob03a.bmp , Prob03b.bmp , Prob03c.bmp , and Prob03d.jpg into the image shown in Figure 3 .
- Green screen processing of image data.
- Differences among bmp, jpg , and png files insofar as green screen processing is concerned.
- Scaling the size of images while maintaining the aspect ratio.
Listing 3: Write the Java application described below.
/*File Prob03 Copyright 2012 R.G.Baldwin
Write a program named Prob03 that uses the class definition shown below and Ericson's media library along with the image files named Prob03a.bmp , Prob03b.bmp , Prob03c.bmp , and Prob03d.jpg to produce the graphic output image shown in Figure 3 below.
Click Prob03.java to download a Java source file containing the solution to this program.
In addition to the output, your program must display your name and the other text shown below on the command-line screen:
Display your name here.
Picture, filename None height 256 width 344
*********************************************************/
public class Prob03{
//DO NOT MODIFY THE CODE IN THIS CLASS DEFINITION.
public static void main(String[] args){
Prob03Runner obj = new Prob03Runner();
obj.run();
}//end main
}//end class Prob03
//End program specifications.| Required output image for Prob03. |
|---|
![]() |
Program 4
Discussion
The following is a non-exhaustive list of concepts that you need to understand along with knowledge and skills that you need to possess in order to successfully write this program and/or understand the given solution in Prob04.java . Some of these items are general in nature and some are specific to the use of Ericson's multimedia library. I won't repeat the items that were listed with the programs in Practice Group 1 or earlier programs in this practice group. Instead, I will concentrate on new concepts, knowledge, and skills not included in previous lists.
- How to design and implement an algorithm that will transform Prob04a.bmp , Prob04b.bmp , and Prob04c.jpg into the image shown in Figure 4 .
- How to use one image as a pattern to perform modifications on another image.
- How to brighten the colors of selected pixels in an image.
- How to tint the colors of selected pixels in an image.
Listing 4: Write the Java application described below.
/*File Prob04 Copyright 2012 R.G.Baldwin
Write a program named Prob04 that uses the class definition shown below and Ericson's media library along with the image files named Prob04a.bmp , Prob04b.bmp , and Prob04c.jpg to produce the graphic output image shown in Figure 4 below.
Click Prob04.java to download a Java source file containing the solution to this program.
In addition to the output image, your program must display your name and the other text shown below on the command-line screen:
Display your name here.
Picture, filename None height 293 width 392
*********************************************************/
import java.awt.Color;
public class Prob04{
//DO NOT MODIFY THE CODE IN THIS CLASS DEFINITION.
public static void main(String[] args){
Prob04Runner obj = new Prob04Runner();
obj.run();
}//end main
}//end class Prob04
//End program specifications.| Required output image for Prob04. |
|---|
![]() |
Program 5
Discussion
The following is a non-exhaustive list of concepts that you need to understand along with knowledge and skills that you need to possess in order to successfully write this program and/or understand the given solution in Prob05.java . Some of these items are general in nature and some are specific to the use of Ericson's multimedia library. I won't repeat the items that were listed with the programs in Practice Group 1 or earlier programs in this practice group. Instead, I will concentrate on new concepts, knowledge, and skills not included in previous lists.
- How to design and implement an algorithm that will transform Prob05a.jpg into the image shown in Figure 5 .
- How to extend a class to make it possible to override one or more methods belonging to the class.
Listing 5: Write the Java application described below.
/*File Prob05 Copyright 2012 R.G.Baldwin
Write a program named Prob05 that uses the class definition shown below and Ericson's media library along with the image file named Prob05a.jpg to produce the graphic output image shown in Figure 5 below.
Click Prob05.java to download a Java source file containing the solution to this program.
In addition to the output images mentioned above, your program must display your name and the other text shown below on the command-line screen:
Display your name here.
Simple Picture, filename Prob05.jpg height 240 width 320
*********************************************************/
public class Prob05{
//DO NOT MODIFY THE CODE IN THIS CLASS DEFINITION.
public static void main(String[] args){
MyPicture pic = new Prob05Runner().run();
System.out.println(pic);
pic.addMessage("String",10,50);
pic.show();
}//end main method
}//end class Prob05
//End program specifications.| Required output image for Prob05. |
|---|
![]() |









