CIT 594 Assignment 2: Wedding Party
Spring 2011, David Matuszek

Purposes of this assignment

General idea of the assignment

Backstory: You are planning a wedding party and dinner. You want to be able to sort the guests in various ways. For example, you want to be able to sort by food preference (beef, fish, or vegetarian), and within each group, by name.

Build a GUI application to do this.


Create a project named WeddingParty. Within that project, create a package called wedding. Within the package, name your main class WeddingParty. WeddingParty should extend JFrame.

Create a class named Guest, with the following instance variables:

Create a text file of, say, 20 or 30 guests, in whatever format you find convenient. (I suggest using the String method split.) You can make up fake names and data.

Use a JFileChooser to locate the text file of guests.

Read in the text file and create an array of Guests.

Display the Guests (showing all four instance variables) in a GUI. A TextArea is probably the easiest to use, but it's up to you. The GUI should include four JButtons, to sort by each of the four attributes (instance variables). Clicking any button should display the newly sorted results.

Sorting must be stable. That is (for example) if you sort by last name, then sort by food preference, all the people within each food prefence should still be alphabetical by last name.

To sort guests, write four classes, each of which implements java.util.Comparator (do not use java.lang.Comparable). Use these Comparator classes in your main program.

Quit cleanly if the user closes the window. You can also provide a Quit button if you like.

General requirements

Same as last time:


As usual. Basis of 100 points, 5 points/day late penalty, max 35 late points.

Due date

Turn your assignment in to Blackboard before 6AM Thursday, January 27.