Lab 3

Streams

February 3, 2005

Lab Partners

Everyone should work with one lab partner on this assignment. If you don't know anyone, Mike will help you find a partner. Submit one solution with both of your names on it.

The First 10 Minutes

Karla Wickens from the International Programs Office will discuss study abroad opportunities in the 8 a.m. and 10 a.m. lab sections. Please do not begin working on the lab until Karla is finished. Thank you.

Before Starting

Create a BlueJ project named inlab3 and copy the Driver.java file that we developed on Monday, January 31st into it. Also, put the following data files into this same directory:

Input Files

The two input files (students1.dat and students2.dat) each contain an unknown number of lines. Each line consists of the last name of a CS 221 student, one or more spaces and then the first name of a CS 221 student. Each file is in alphabetical order where the last name serves as the primary key and the first name serves as the secondary key.

Task

Modify the lecture code so that it merges the two input files and produces an output file named cs221.dat. The output file should be in alphabetical order (using the last name as the primary key and the first name as the secondary key) and should not contain duplicates. Each line of the output file should be a last name (use the same case as the input file), followed by a single space, followed by a first name (use the same case as the input file).

Hint

Use the StringTokenizer class to break apart an input line into a last name and a first name.

Grading

What to Submit

E-mail your code to Mike Thiesen at mthiesen@gmail.com in one message. The subject of the message should be: CS221-xx inlab3 your names. The xx is the number of your lab section.

Before You Leave

Delete the inlab3 project that you created. Empty the recycle bin. Thank you.