CS 1711 Recitation Laboratory 6:
The Song and CDImage classes - working with arrays of objects


Hand-in Requirements (Deliverables):

All projects and laboratories will be submitted electronically through webCT. Zip up your entire project directory for submission. (Right click on the project folder and follow the SentTo link.) The project source directory should include the following:


RealAudiophonic Inc. produces software to manage the playing of music CDs on computers. You have been hired to produce two of the classes needed for the RealAudiophonic CD Manager.

In Parts I and II you will implement a Song class that represents individual pieces of music. The Song class implements Comparable and contains the following information about the song: the length of the song in seconds, the artist name, and the song name. The compareTo method uses song names to determine order. If the song names are the same, then the artist names are checked.

In Part III you will implement a CDImage class that represents a music CD. The CDImage class contains the title of the CD, the label (company that produced the CD), and the number of tracks. The CDImage class also provides access to Song objects representing the individual songs on the CD.

Part I: Project setup

Part II: Implementing and testing the Song class

Part III: Implementing and testing the CDImage class

Design a CDImage class to represent a music CD. The constructor takes three parameters: the title of the CD, the recording label, and the number of tracks on the CD. (Each track contains one song.) The CDImage class uses the Song class developed above and should contain methods to accomplish the following: Implement the CDImage class. Design a client program CDImageTester that tests all of the methods in the CDImage class. During the laboratory, the constructor, the attributes, and the toString method of CDImage will be implemented. The remaining methods should be implemented on your own. Create a CDImage with at least 5 songs on it for testing.

For testing you may use your own lists of songs, or you can use the following list of Elvis Presley songs:
    My Baby Left Me   121
    We're Gonna Move  150
    Poor Boy          133
    When My Blue Moon Turns to Gold Again 141
    Tell Me Why       120
These songs appear on an album entitled "Elvis: The Other Sides" put out by RCA.

The following list of George Strait songs appear on an album entitled "If You Ain't Lovin' (You Ain't Livin')" put out by MCA Records:
   Under These Conditions 208
   Don't Mind If I Do  198
   It's Too Late Now   149