Homework J7

Due: Tuesday, 3 May 2005 by 11:59 p.m.


Home | Resources | Homeworks | Slides | Labs | Contacts | Submit | Forums | Private

Testing

Objectives

 

Files

Two files need to be downloaded: Pixelator.java (a homework template) and GUI.class. The two files should be kept in the same folder.  Only one file needs to be submitted: Pixelator.java.  Class Pixelator provides a fading mechanism for observing how one graphical image can fade into another image. The initial, final, and intermediate graphical images are stored as a two-dimensional array with int-valued elements.  Class GUI provides a way for you to test your Pixelator implementation. The default constructor for class GUI creates a graphical user interface that enables uses of the GUI to select both initial and final images. The interface also provides a button whose selection initiates a testing of Pixelator.  We provide the initial and final images.

 

Pixelator Requirements

Constructor

Instance methods

 

Class methods (static methods)

 

How we did it – some observations on instance variables and implementation

Instance variables

We maintained six instance variables to represent the current pixelator situation. Methods made sure that these variables always reflect the current goings-on of the pixelator

Constructor observations regarding the state of our instance variables

Method beginFade() observations regarding our implementation

Method randomize() observations regarding our implementation

 

Testing

In an effort to test your code, we have provided a seires of testing routines for you to use. In order to run them, change your main() method to contain only the line:

GUI.tester();

NOTE: If you downloaded the GUI.class file prior to 8:45 p.m. on Monday, 25 April 2005, you will have to download it again (and overwrite your old GUI.class with the new one)

This line replaces the two lines of your main() method that are in the skeleton code (you probably want to comment the existing lines out so you can easily restore them later). When run, the output should be the following.

randomizeWorks: yes
copy2DArrayWorks: yes
constructorCompletes: yes
constructorWorks: yes
beginFadeWorks: yes
stopFadeWorks: yes
canIncreaseFadeWorks: yes
getImageWidthWorks: yes
getImageHeightWorks: yes
getImageWorks: yes
unitFadeIncreaseWorks: yes
percentageFadeIncreaseWorks: yes

For each method, it will simply print a 'yes' or 'no' if the method works (or does not work) correctly. Using this tester() method, you can test the methods that you write one at a time. Once they are all working properly, you can restore the original main() method, and test out the entire program.

 

Submission

When you are finished, submit Pixelator.java.