Due Date:
Thursday, September 24
File(s) to be submitted:
Playable.java, Rateable.java, MediaItem.java, Song.java, Podcast.java, AudioBook.java, PlayMedia.java
Summary
Your task is to create a media player that can handle songs, podcasts and audio books (possibly among others). All media items are playable, but each type plays in a different way and has different extra information.Make good use of inheritance and polymorphism. Throw exceptions as appropriate.
Create a simple program (PlayMedia) that creates a List of MediaItems, populates the list, and then:
- prints the description for each item.
- plays each item.
- for each item with a rating, shows the rating for that item.
Note that that's three loops, not just one loop doing three things with each item.
There must be at least two of each kind of media item, and at least two ratable items, at least one each with and without ratings.
Design your program so that it may be extended easily for other playable and rateable media types.
Here are the descriptions of each data type class and interface you need to create:
It also has a displayInfo method that prints its title and length.
Finally, it has an abstract method play that each subclass has to implement.
This class is abstract, and so it cannot be instantiated on its own.
Each of the media types must have a constructor that sets all the fields described above. It should not have setters for any field that isn't explicitly said to have a setter.
Songs are also rateable. It is rated out of five stars, and each new rating replaces any old rating. Each Song should start off unrated, and trying to get the rating of an unrated song should return NaN.