CS 1401 Assignment #13

Date Assigned: Wednesday, April 23, or Thursday, April 24, 2008.

Due Date: Wednesday, April 30, or Thursday, May 1, 2008, before the beginning of your lab section.

Objective: The main objective of this assignment is to use many concepts and techniques that you learned in this class.

Background: In this programming assignment, we will process XML files, files which are used in second generation Internet, in e-commerce, etc. In XML, different pieces of information are marked by tags.

We will consider XML files that consider information about registered voters. For simplicity, we will consider files in which each line has the voterís name and the political party in which the voter has registered. To mark this information, we will use two tags: NAME and PARTY. For example, a line

<NAME>Victoria Voter</NAME>†††† <PARTY>Independent</PARTY>

means that the voter's name is Victoria Voter and she is registered as an ďIndependentĒ voter. The same information can be described as

<PARTY>Independent</PARTY>†††† <NAME>Victoria Voter</NAME>

In general, everything between the starting and the ending NAME tags is a personís name, and everything between the starting and the ending PARTY tags is a political party.

Programming assignment: First, define a class Voter with two fields: voterís name and political party. Your program should ask the user for the name of the corresponding XML file. Then, it should read this file line-by-line, extract from each line the name and the party, and store the resulting information in an array of voters.

After that, you should design a GUI which takes the name of the voter, and returns either his or her party, or, if the voter's name was not in the original file, the word "unknown".

Deliverables: as instructed by your TA.