Fall 2005, David Matuszek
Purposes of this assignment:
General idea of the assignment:
People often have to learn pairs of things that go together (in psychological jargon, paired associates). Given one of them (the stimulus), the person has to come up with the other (the response). For example:
Dr. Dave; response:
6 * 9; response:
54(or 42 for HHG fans))
As your customer, I want a program to help me memorize lists of things--for example, German vocabulary words. In addition, I want a program to help me construct these lists in the first place.
An item is a single pair of things to learn (for example,
Harrisburg). In addition to the stimulus and response, an item
keeps track of how many times in a row it has been answered correctly (as a
rough measure of how well the item has been "learned.") The
class should have the following capabilities:
||Constructor; the number of times correct will be initialized to zero.|
||Setter and getter methods;
||Keeps track of the number of times in a row that this item was answered
The most important component of the
StudyList class is a list
of items to be studied. Your class will keep these items in an
java.util.ArrayList), which has the important feature that it
can grow as you add items. Declare and define your array list with the following
somewhat unusual syntax:
ArrayList<Item> studyList = new ArrayList<Item>();
Except for constructing the list, you do not need any unusual syntax. You can
explore the API for methods to use with an
ArrayList, but most
or all of your work will be done with the
ListIterator (see below).
StudyList class should have the following capabilities:
Read in a list of items from the given
You can assume that the file being read in has the correct syntax.
||Save the item list to the given
||Simply gets and returns a
StudyListEditor is a Swing-based application (with a
method) for editing study lists. Only one study is edited at a time. The
GUI should have the following controls:
It is important for the programmer to realize that there can be a difference
between the item information displayed on the screen and what is actually in
Item. The user should not have to know about this. Hence, almost
any action (except typing into a text field) should cause the program to check
the inputs and update items appropriately, before the action is taken.
Stimulus and response values should be trimmed (use String method
trim()) before being stored in the
Item. An "empty"
stimulus or response field (one that is zero length after being trimmed) should,
in most cases, cause a warning message to be displayed and the requested operation
to be aborted. (It should be OK to delete an item with empty fields.) To minimize
code duplication, I suggest the use of a private boolean method to do this checking.
Study is a Swing-based application (with a
method) for helping the user memorize study lists. The display should be as
An item is considered to be "learned" when the user gets it correct a certain number of times (say, 3) in a row. Learned items are kept in the study list, but are not ever presented to the user.
When all items have been learned and there is nothing more to display, the program should bring up a dialog box to so inform the user. The user should be given an opportunity to save the study list. The program does not quit automatically at this point, because the user may wish to use a different study list.
Do JUnit testing on the
Item class. The
Study classes are basically GUI classes, and must be tested
by hand. The
StudyList class reads and saves files, and returns
ListIterator for the internal
nothing much to test.
One member of your team should write the
and the other member should write the
Study class (these are both
basically GUI classes, of roughly comparable difficulty.) If you have no partner,
you can omit the
StudyListEditor class. Use
tags to specify who did which class.
One member of your team should write the
load method and the other
save method, so that each of you gets some experience with
@author tags do not apply to individual methods, but
you can put your name in an ordinary comment.
Thursday, November 17, before midnight. As usual, please submit one zip file, via Blackboard, containing all necessary files.