Question: Can someone help me with this, I'm new to Java and I have tried to put this assignment together and would appreciate it if someone

Can someone help me with this, I'm new to Java and I have tried to put this assignment together and would appreciate it if someone could work out both tasks so I know if I'm on it. Can someone help me with this, I'm new to Java and Ihave tried to put this assignment together and would appreciate it if

Assignment 01: Refactoring YourPrime Task 01: Exception Handling (6 marks) The program YourPrime is a digital media library comprising of movies, songs and books. As a subscriber of this program, you can create a playlist for each media subtype and store these playlists in your MyMedia object. The fees associated with each media subtype are dependent on the genre type and the rating of the media object. Genre is an abstract class with a single instance variable (price) and an abstract method called setPrice (int). The inheritance tree for the class Genre is presented below: These genre subtypes are exclusive to a specific media subtype (indicated by the boxes with dashed-lines), i.e., the Rock, Rap and Pop classes are for Song, the Action, Comedy, and Drama are for Movie and the Fantasy and Autobiography are for Book. However, in the current implementation, there is no constructor validation for our media subtype, therefore it is possible to assign any genre types regardless of the media subtypes, e.g., Book b = new Book("Oliver Twist", "Charles Dickens", 1838, 5, 608, new Rock()); // this should not be allowed! This is not ideal - more so, this has the potential to create havoc when we want to calculate our subscription fees. One way to handle this issue is to implement a static factory method called of () to handle object instantiation. The of () method will check the validity of the genre according to the media subtype, and return a new object if the check is valid, or throw an IllegalargumentException otherwise. Task 02: More orderByType variations (4 marks) In the existing MyMedia class, you can perform five (5) different sorting operations (by price, rating, title, duration, and number of pages). You are required to add two (2) new sorting operations that will allow subscribers to sort based on the artist (for songs), and authors (for books). Complete the codes for the sort () method in MyMedia class [4 marks - 2 marks each] You need to add two new sorting method (in the sort () method) to compare artists for the Song class (compareByArtist) and authors (compareByAuthor) for the Book class. You are also required to add new conditional statements to enable these sorting options

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!