|
by
[Exercise |
API Docs |
Short Course|
Exercises]
|
This class is very simple. It should reside in the same directory as MusicStore and
TestMusicStore.
Task 2
Add the instance variable titles of type MusicTitle[] to MusicStore, initialized to null, and then implement the access methods setTitles() and getTitles().
Note that getTitles() does not process the individual array elements; it simply
returns the reference for the titles instance variable. setTitles() should take
a MusicTitle array, that is, data type MusicTitle[], as an argument.
getTitles() should return the reference to the instance variable for the array.
Task 3
Add a displayMusicTitles() method to MusicStore that traverses the array of titles and displays the title-artist data.
This method is similar to displayDiet() from the course notes.
Task 4
Modify TestMusicStore to test/display the functionality of MusicStore's displayMusicTitles() method.
You should create two or more instances of MusicTitle and store the references to these
instances as array elements.
Task 5
Compile the source code for MusicStore and TestMusicStore.
Some Java environments require a CLASSPATH setting. You should set the CLASSPATH
environment variable to include the current directory, but only if your environment requires
CLASSPATH.
Task 6
Execute TestMusicStore.
With the JDK, for example, simply invoke the Java interpreter with TestMusicStore as an argument:
D:\>java TestMusicStore
Copyright 1996-2000 jGuru.com. All Rights Reserved.
|
| ||||||||||||