Question: in java Playlist Channel -name : String shared : boolean - name : String - playlists + Channel(name : String, size : int) + addPlaylist(p:


in java
Playlist Channel -name : String shared : boolean - name : String - playlists + Channel(name : String, size : int) + addPlaylist(p: Playlist): boolean + deletePlaylist(p : Playlist): boolean + flipSharedStatusOf(p: Playlist): boolean + getPlaylist[category: Category): Playlist + sortPlaylists(): void + toString(): String + Playlist + Playlist(name : String, shared : boolean, size : int) + addVideo(v: Video) : boolean + remove Videov: Video): boolean + countVideosOf(category : Category): int + sortOnDuration : void + getName(): String + isShared(): boolean + SetShared(shared : boolean) : void + equals(obj: Object): boolean + toString : String 1 - videos > Category COMEDY EDUCATION ENTERTAINMENT SPORTS OTHER Video - id:int -title: String - duration: int - category : Category + Video(id:int, title: String, duration : int, category : Category) + getDuration: int + getCategory : Category + equals(obj: Object): boolean +toString: 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 getCategory(): 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 o 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 otoString(): 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 Exercise 1: Write the previous classes. Exercise 2: Write a main method that tests the functionalities of the previous classes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
