In this assignment, you'll implement a portion of one of the experiments described in this paper by forumer IU Psychology student Cathy Sandhofer and her advisor, Linda Smith:
(You don't have to read the paper. The reference is here just in case you want to look it up.)
In the experiments, Sandhofer and Smith were interested in why color adjectives such as red are learned differently than size adjectives such as big. In particular, color words are associated with one another before they are associated with the features that they represent, while the opposite is true for scalar adjectives like big. They investigated the possibility that this is related more to how the words are presented to children by parents than to anything about the meanings of the words themselves. They tested this idea in experiments with adults who were taught new adjectives referring to dimensions that they didn't already have labels for, for example, color saturation and brightness. Some of the subjects were taught the adjectives in one way ("comprehension"), and the others were taught in another way ("production)". For this assignment, we'll only implement a modified version of the comprehension condition. For each training trial in this condition, the subjects saw three figures and were asked "which one is X?", where X was one of the six adjectives being learned. They picked one and were then told the right answer. Later they were tested on figures they had never seen to see if they had learned the meanings of the adjectives. The comprehension task was supposed to resemble the way adjectives like "big", as opposed to adjectives like "red", were learned.
Download
the program.
It includes the source files you should start with and their compiled class files (in V1/),
and the compiled version of the program as it should work if you've done all of the parts
of the assignment (in V2/).
Run the version in V2 to see what the program should do; the main() method is in the Adjectives class.
You will notice three components in the program's frame, a panel where the figures appear, a text area where text appears, and another panel containing the single button. When you click on the button, the instructions for the experiment appear in the text area. When you click again on the button (whose label has changed), the program randomly picks one of the six adjectives that is being taught, writes the question for this word in the test area, and draws three figures in the top panel, only one of which is correctly described by the given word. When you click on one of the figures, the program responds by circling the correct figure and printing in the text area whether your selection was right or wrong. It also records this result in a file called "responses". Clicking again (anywhere in the figure panel) brings up a new question and set of figures. The program repeats these two steps (presentation of figures and question for a randomly selected word, feedback about your response) until you click on the button again to stop the experiment.
For this assignment you will need to submit your whole program, that is, all of your source files. The number of files will depend on which classes you create. Be sure to insert comments in the code when appropriate and to indent the code properly.
To submit the assignment, first compress your program into a single file. Then go to the Vincent page for the class, and submit this file.
The version of the program that you start with (in V1)
has three classes, Adjectives, which just has the main() method;
AdjFrame, which extends JFrame; and FigurePanel, which extends JPanel.
Run this version of the program, and look at the .java files
for the three classes.
In AdjFrame, the three components within the frame are created with their appropriate sizes,
the button gets an ActionListener, and the general behaviors of the program for
when the button is clicked are specified in actionPerformed().
This class also has static methods for writing in the text area
as well as for generating random integers.
Within the FigurePanel class, there are constants for many things you will need (see below) as well as methods for drawing the three kinds of figures that appear in the FigurePanel: squares, circles, and regular pentagons.
The stimuli for the experiment are defined along four dimensions: saturation, brightness, hue, and shape.
There are six possible values for each of the first two dimensions, and two each for the second two.
The possible values of saturation, brightness, and hue are defined in the two-dimensional constant
array COLOR_VALUES in the FigurePanel class.
Note that the array contains floats; this is because the static Color method
getHSBColor() that you will need to use to create colors from the values
requires floats.
The value of shape should always agree with the hue value for a figure;
"red" figures (hue = 0.0) are always square, and "blue" figures (hue = 0.667)
are always pentagons.
The static figure-drawing methods in FigurePanel draw figures of particular
sizes centered on particular points.
Constants in the FigurePanel class specify possible values to use for the sizes
and centers.
The adjectives used in the experiment are given as Strings in the constant
array WORDS in the FigurePanel class.
The first three of these label differences in saturation, one for every two possible
values in the order that the values appear in the COLOR_VALUES array.
The second group of labels refers to different values of brightness in the same way.
For example, the adjective "RIF" labels the values 0.1 and 0.2 on the saturation dimension,
and the adjective "MELGY" labels the values 0.7 and 0.8 on the brightness dimension.
Hue and shape are distractor dimensions; that is, they are irrelevant for the
the words being learned.
So if you wanted to create a random instance of the word "ZUP", you'd randomly
select either 0.8 or 1.0 for saturation, randomly select any of the six possible
brightness values, and randomly select 0.0/SQUARE or 0.667/PENTAGON for hue and shape.
The assignment is divided into four parts. You get full credit if you complete the first two parts and extra credit if you complete any of the rest. I'm not giving you any suggestions about how to implement the program; you can do this however you want. You may want to create one or more additional classes; notice that my version of the final program has classes Figure and Stimulus. If you can't complete one part and want to go on to the next, make sure your comments make clear what your program can and can't do.