| Homework 5DetailsPractice with ArrayList
In the music-organizer-v5 project from Chapter 4:
- Add a playingTime field of type int to the Track class.
- Update the setDetails method to include the playing time.
This will introduce compiler errors until you do the next item.
- Set playing time to a default value of 99 in the existing constructors.
- Add a third constructor (with parameters including artist, title, and filename) that can set the playingTime to a different value.
- Add an accessor method for playing time.
- Update the getDetails method to include the playingTime.
-
Add a method for the MusicOrganizer class named getTotalPlayingTime()
with an int return type.
It should add up and return all the values of playingTime for all the
tracks stored in its ArrayList.
-
Add a method for the MusicOrganizer class named get99MinuteTracks()
that returns an ArrayList with all the tracks that have a 99 minute playing time.
When you have completed this assignment, select "Create Jar File ..."
from the Project menu in BlueJ. Check "include source" and "include Bluej project files".
Save the file with the name bassett-ch4exercises.jar (except use your name instead of bassett).
Then upload the "jar" file into Moodle no less than 10 minutes before the start of class.
|
|
|