Download the jar file lab1.jar and import it into eclipse. The last part of this clip shows how to import a jar into eclipse (the first part shows how to download the type.jar file, but we do not need that jar file here).

Create the program named Lab1 that prompts the user by printing

Enter the name of the iTunes library XML file: 
The file name should be entered on the same line (see sample run below). If the user enters the name of a non-existing file, then your app should print
That file does not exist.
If the file exists, but the Library class fails to parse it, then your app should print
That file is not in the right format.
Otherwise, the file is an iTunes library XML file. A sample can be found here. Your program should print the names of all the tracks that are part of a playlist. However, each name should be printed only once. Furthermore, before each name you should print how often the track has been played (the counter and the name are separated by a tab). The tracks should be printed from most played to least played. In case of ties (that is, two or more track have been played the same number of times), the tracks should ordered using the lexicographic order (as used in a dictionary and a phone book).

Here is a sample run (where the user has entered library.xml)

Enter the name of the iTunes library XML file: library.xml
99      The Twist
87      Hotel California
75      Respect
27      Hey Jude
26      Imagine
19      Billie Jean
19      In the Ghetto

Hint: you may want to use a datastructure that combines a Map and a Set.

Frequently asked questions

Question: When is Lab 1 due?
Answer: Submit your solution before Saturday January 17.

Question: How do I submit my solution?
Answer: Log into a computer of the Prism lab (clips showing how to log in from home and transfer files can be found here). Transfer your Lab1.java to your EECS account (if it is not already there). Create a file named group.txt in the directory that contains Lab1.java. Each line of the file group.txt contains the EECS login name of a member of the group. Open a terminal and go to the directory that contains the files group.txt and Lab1.java. In that directory, run the following command.

submit 1030 lab1 group.txt Lab1.java
If something fails, you will be see something like
submitted:  group.txt (19 bytes)
submitted:  Lab1.java (1673 bytes)
All files successfully submitted.

Your code compiled successfully.
The following lines are printed in the wrong order(see library2.xml)
1       Like a Rolling Stone
1       I Gotta Feeling
Submitted files have been removed.
Submit again.
In that case, you can find the file library2.xml in the directory that also contains the files group.txt and Lab1.java. It allows you to see for which input your code failed. Fix your code and submit again. If you successfully submitted your code, you will see something like this
submitted:  group.txt (19 bytes)
submitted:  Lab1.java (1647 bytes)
All files successfully submitted.

Your code compiled successfully.
Your code passed all the tests.
Your code contains no style errors.
Your group.txt file has been successfully validated.

Question: May we work in groups?
Answer: Yes. Each group is expected to do their own work. If two or more groups collaborate, they should merge into one group, rather than submitting two very similar solutions. Advanced software tools will be used to detect the copying of code. If one group copies from another group, both groups are academically dishonest.

Question: Should Lab 1 be part of a package?
Answer: No.

Question: Where should I save the library.xml file?
Answer: Assume /home/franck/workspace is the directory containing the workspace of eclipse. Assume that you have created a project named 1030. Then save the file in the directory /home/franck/workspace/1030.

Question: When I run my app with a XML in the wrong format, the app also prints [Fatal Error] library4.xml:1:1: Content is not allowed in prolog. Is that okay?
Answer: Yes.

Question: Can I run the Lab1 app on my iTunes library?
Answer: Yes. Your iTunes Music Library.xml file can be found in Music/iTunes.