Objectives:
| Assignment: Define a class Song. This class will have fields for the title of the song, the Sound object for the song, and the number of times that the song has been played. Create a constructor for this class in which you will provide the title and the Sound object. Initially the number of times played should be zero and therefore does not need to be sent as a parameter to the constructor. Write a method play() which plays the song. Write a method getTitle() which returns the String value for the title of the song. Write a method getTimesPlayed() which returns the integer value for the number of times that the song has been played. |
| Assignment: Define a class Slideshow which has two arrays as fields: an array of pictures, and an array of sounds. The constructor for this class will let users pass two arrays when creating a new Slideshow object. The class will have a method show() that plays the slideshow. It should display each picture in its array, one at a time. While the picture is showing, your object should play the corresponding sound file. Write a main
program which builds two arrays, creates a Slideshow object, and
plays the slideshow. |