Name Surfer is a program that reads and displays data on the one thousand most popular baby names at the beginning of each decade for the last one hundred years. The user enters a name, and the program graphs the rank of that name over time. A ranking of 5 means that the name was the 5th most popular that year, and its point for that year will be plotted near the top of the graph. A ranking of 879 means that the name was not that popular, so its point for that year will be plotted near the bottom of the graph
Here is a screenshot of a Name Surfer program in action:
You can run a demonstration version of a Name Surfer program. Download the name-surfer-demo.zip file into your homework directory. Unzip the file. It contains a directory with two useful files:
java -jar name-surfer.jar
or double-click on the file's icon in a window.
The demonstration is just an example. You do not have to produce an interface that looks identical to this one.
Write your program as a collection of the following classes:
NameSurfer consists only of a main() method. This method should first create a NameFileReader to read name data from a text file. The user can specify the file name as a command-line argument, or she can rely on the default value of names-data.txt. It should then creates a NameSurferFrame and displays the frame on the screen.
A NameSurferFrame consists of an interaction panel at the bottom of the window and a graph panel at the bottom.
A NameFileReader reads a file of name data into a Vector of NameHistory records. Each line in a file of name data contains twelve tokens: a name followed by eleven integers. The integers correspond to the name's rank in 1900, 1910, 1920, ..., 2000. If the name did not occur in the top one thousand names of a year, the entry will be 0.
Finally, create a readme.txt file that explains the design of your program and lists all of its Java files, in the order they appear in your print-out
As always, take small steps. I suggest that you take steps at least this small:
void setResizable(boolean resizable)
If you encounter problems graphing a name's history, you can temporarily replace that behavior with a call to Graphics.drawString(), writing a simple line to the graph panel. That way, you can test your look-up method and (indirectly) your NameFielReader's behavior independent of the tougher graphics.
By the due date and time, submit the files
Be sure that your submission follows all homework submission requirements.
This assignment is based on Nick Parlante's Name Surfer assignment, presented as part of the Nifty Assignments panel at SIGCSE 2005. You can read the handout that Nick gives his CS I students, if you'd like. It talks about the data, describes some interesting social experiments you can do with the program, and outlines an approach for writing the program. Some of his approach may not be all that clear because it depends partly on what he has discussed in his classroom. But it may be helpful to you. I've made changes to the assignment, so don't rely on any of the handout's details when doing your assignment. (Keep in mind: it was written for CS I students.)