COSC 2125 Lab #5

Due Date: Friday, October 16th by 10am in JBWN 223

For this assignment you will add a date field to your ITuneSong class and thus adjust methods you provide to allow for a date. The date field could be a GregorianCalendar object which supports equals and implements Comparable so it would allow values to be ordered and compared by date correctly.

The major objective of this assignment is to create 2 different linked list classes, the first class will be a linked list of ITunePlayList objects named PlayLists. This will require you to modify the ITunePlayList class so that it will also have a name as well as a list of songs, a count, and a saved value. The PlayLists class will be implemented as a linked list of ITunePlayList objects. The PlayLists class will maintain a list of individual PlayList objects that will not be sorted in any particular order. The PlayLists class must implement the LinearList interface. Be sure you also write toString() and a proper default constructor as well as the methods in the interface.

The second class will be a linked list of ITuneSong objects named RecentlyAdded. This linked list will be sorted in DESCENDING order by the date of the ITuneSong. So the most recently added song will be at the top or front of the list. This class will always be sorted in descending order by date.If 2 or more songs are added on the same date, then break ties by title and then by artist as needed. The RecentlyAdded class will be SORTED in descending order by date(of the ITuneSong objects) and it must implement the SortedList interface and it must be a linked list.

To implement dates you can use the GregorianCalendar class and you will need to write some methods to allow dates to be converted to a String and allow dates to be read in as a string and converted to a GregorianCalendar. You will have to modify the constructors and many methods in ITuneSong so that the date fits in correctly. For a default date use January 1, 1970. You will need to modify the readFromScanner to now read in a date as well, which should be on any input stream as the last line in the format mm/dd/yyyy.

You will need to write a Test class driver with a main method that shows that all new classes work correctly. The list classes (PlayLists and RecentlyAdded) MUST use a linked list and must implement the specified interfaces respectively. Of course you will also write other methods such as constructors, accessors, modifiers, toString() as needed/expected.

You must write a toString() method for each of the classes, and it would probably be helpful to write a toDateString() method that will create and return a String of the date in a standard format such as mm/dd/yyyy or something similar. (The GregorianCalendar class has a toString() method that creates way too much data for our needs - try it and see.) OR you might want to extend GregorianCalendar and create a SimpleDate class of your own.

Hand in:

  1. Cover sheet with your name, lab # , date.
  2. PlayLists class source code with documentation.
  3. RecentlyAdded class source code with documentation.
  4. Test class source code that tests all new classes.
  5. Script file of the output of your with labeled testing of all the interfaces - add,remove,empty,full,removeall, contains on both list classes.