CS 1401 Assignment #13

Date Assigned: Wednesday, November 28, or Thursday, November 20, 2007.

Due Date: Wednesday, December 5, or Thursday, December 6, 2007, 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 students. For simplicity, we will consider files in which each line has the name and the major of a single student. To mark this information, we will use two tags: NAME and MAJOR. For example, a line

<NAME>Carlos Acosta</NAME>     <MAJOR>Computer Science</MAJOR>

means that the student's name is Carlos Acosta and his major is Computer Science. The same information can be described as

<MAJOR>Computer Science</MAJOR>     <NAME>Carlos Acosta</NAME>

In general, everything between the starting and the ending NAME tags is a name, and everything between the the starting and the ending MAJOR tags is a major.

Programming assignment: First, define a class Student with two fields: name and major. 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 major, and store the resulting information in the array of students.

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

Deliverables: as instructed by your TA.