Question: Your program will simulate a media library. We will work with four types of media: books, pictures, music, and movies. Design and implement a class
Your program will simulate a media library. We will work with four types of media: books, pictures, music, and movies. Design and implement a class hierarchy consisting of the Media, Picture, Music, Movie, and Book classes. Media class This class should be an abstract class. A Media object has a name, and a rating. The rating is an integer number. You need to implement the constructors, accessor, and mutator methods as needed. This class should have two abstract methods:
toString method will be used to collect and return (as a String) all of the information of a Media object. getMediaType method will be used to return (as a String) the type of a Media object (such as Book, Movie, Music, Picture). Book class A Book is a kind of Media that has an author and a number of pages. Book should implement the toString and getMediaType methods of Media. The toString method displays all the book information, including media type, name, author, number of pages, and rating. Make sure you also implement any other methods (such as constructor, accessor, and mutator) as needed by Book. Movie class A Movie is a kind of Media that has a director. Movie should implement the toString and getMediaType methods of Media. The toString method displays all the movie information, including media type, name, director, and rating. Make sure you also implement any other methods (such as constructor, accessor, and mutator) as needed by Movie. Music class A Music is a kind of Media that has an artist. Music should implement the toString and getMediaType methods of Media. The toString method displays all the music information, including media type, name, artist, and rating. Make sure you also implement any other methods (such as constructor, accessor, and mutator) as needed by Music. Picture class A Picture is a kind of Media that has a resolution. The resolution of a picture is an integer number that measures the dot per inch. Picture should implement the toString and getMediaType methods of Media. The toString method displays all the picture information, including media type, name, resolution, and rating. Make sure you also implement any other methods (such as constructor, accessor, and mutator) as needed by Picture. Test class Implement a test class to simulate a media library. You should have an array of Media that stores at least 14 different objects of types: Music, Book, Movie, or Picture.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
