Question: Exercise 1: Create the classes along with the functionality given in the following UML Diagram. To understand the problem, please refer to the description given




Exercise 1: Create the classes along with the functionality given in the following UML Diagram. To understand the problem, please refer to the description given after the diagram. Channel - name : String playlists + Channel(name : String, size : int) + addPlaylist(p Playlist): boolean + deletePlaylist(p: Playlist): boolean + flipSharedStatusOf(p: Playlist) : boolean + getPlaylist(category C): Playlist 1 + sortPlaylists:void String + to String String Playlist -name: String - shared boolean + Playlist + Playlistname : String, shared : boolean, size : int) + addVideo(v: Video) : boolean + remove Video(v: Video): boolean + countVideosOf(category :) int + sortOnDuration : void String + getName(): String + isSharedo :boolean + SetShared(shared : boolean): void +equals(p: Playlist): boolean + toStringo String 1 videos Category COMEDY EDUCATION ENTERTAMEN SPORY OTHER X Video idint -title: String - duration int - Category: String +Video(id:int, title: String, duration : int category: guppery getDuration in + getCategoryo String equals(v: Video): boolean + toString String String Video Class: Attributes: o id: the ID of the video o title: the title of the video o duration: the duration of the video in seconds o category: the category of the video Methods: o Video(id:int, title:String, duration:int, category:Category): constructor o getDuration(): returns the duration in seconds of the video o getCategory0: returns the category of the video o equals(obj:Object): compares two objects of type Video based on their id and returns the result of the equality o toString(: this method returns a string representation of the video Playlist Class: Attributes: o name: the name of the playlist o shared: the sharing status of the playlist; true if it's public and false if it's private Methods: o Playlist(): default constructor for an empty playlist o Playlist(name:String, shared:boolean, size:int): constructor o addVideo(v:Video): adds a video to the playlist if there's space and the video wasn't added before o removeVideo(v:Video): removes a video from the playlist if it's there while maintaining the order of the playlist o countVideosOf(category:Category): returns the number of videos of a certain category currently in the playlist sortOnDuration(): sorts the videos in the playlist ascendingly based on the duration o getName(): returns the name of the playlist o isShared(): returns the shared status of the playlist o setShared(shared:boolean): sets the value of the shared status of the playlist o equals(obj:Object): compares two objects of type Playlist based on their name and returns the result of the equality o toString(): this method returns a string representation of the playlist Channel Class: Attributes: o name: the name of the channel Methods: o Channel(name:String, size:int): constructor o addPlaylist(p:Playlist): adds a playlist to the channel if there's space and the playlist wasn't added before o deletePlaylist(p:Playlist): removes a playlist from the channel if it's there by replacing it with the last playlist in the channel o flipSharedStatusOf(p:Playlist): flips the shared status of a playlist if it's there in channel o getPlaylist(category:Category): returns the playlist in the channel having the most videos of a certain category if possible o sortPlaylists(): sorts all videos in each playlist in the channel ascendingly based on duration o toString(): this method returns a string representation of the channel
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
