Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a video manager. You can add videos, create playlists, generate HTML for playlists Genre.java public enum Genre { Comedy, Educational, Documentary, Music, FilmAnimation }

Implement a video manager. You can add videos, create playlists, generate HTML for playlists

Genre.java

public enum Genre { Comedy, Educational, Documentary, Music, FilmAnimation }

Playlist.java

public class Playlist { private String name; private ArrayList videoTitles;

/*Initializes playlist with the specified name and creates an empty ArrayList. If the parameter is null or is a blank string (according to String class isBlank() method) the method will throw an IllegalArgumentException (with any message) and perform no processing.@param name*/ public Playlist(String name) { }

/** Get method for name @return name string*/ public String getName() { }

/**Initializes the current object so changes to the current object will not affect the parameter object.@param playlist */ public Playlist(Playlist playlist) { }

/**Provided; please don't modify. toString for class@return string with object info*/ public String toString() { String answer = "Playlist Name: " + name + " "; answer += "VideoTitles: " + videoTitles; return answer; }

/** Adds the title to the Arraylist storing titles. We can add the same video title several times. If the parameter is null or is a blank string (according to String class isBlank() method) the method will throw an IllegalArgumentException (with any message) and perform no processing.@param videoTitle@return true if title is added; false otherwise */ public boolean addToPlaylist(String videoTitle) { }

/**Get method for the ArrayList of titles. You must avoid privacy leaks.@return ArrayList with titles*/ public ArrayList getPlaylistVideosTitles() { }

/**Removes all instances of the title parameter from the ArrayList of titles. If the parameter is null or is a blank string (according to String class isBlank() method) the method will throw an IllegalArgumentException (with any message) and perform no processing.@param videoTitle@return true if the ArrayList (videoTitles) was changed as a result of calling this method and false otherwise.*/ public boolean removeFromPlaylistAll(String videoTitle) { }

/**Randomizes the list of titles using a random parameter and Collections.shuffle. If the parameter is null, call Collections.shuffle with just the ArrayList.@param random*/ public void shuffleVideoTitles(Random random) { } }

Video.java

public class Video implements Comparable

{ private String title, url; private int durationInMinutes; private Genre videoGenre; private ArrayList comments;

/**Initializes a video object. If any parameter is null or if a string parameter is a blank (according to String class isBlank() method), the method will throw an IllegalArgumentException (with any message) and perform no processing. Also the same exception will be thrown if the duration is zero or negative.*/ public Video(String title, String url, int durationInMinutes, Genre videoGenre) { }

/**Initializes the Video object so changes to the parameter do not affect the current object. Your implementation must be efficient (avoid any unnecessary copies).@param video*/ public Video(Video video) { }

/**Get method for title @return title string */ public String getTitle() { }

/**Get method for url @return url string */ public String getUrl() { }

/**Get method for duration@return duration */ public int getDurationInMinutes() { }

/**Get method for video genre @return string with genre */ public Genre getGenre() { }

/**Provided; please don't modify.*/ public String toString() { String answer = "Title: " + "\"" + title + "\" "; answer += "Url: " + url + " "; answer += "Duration (minutes): " + durationInMinutes + " "; answer += "Genre: " + videoGenre + " "; return answer; }

/**Adds specified comments to the video. If the parameter is null or is a blank string (according to String class isBlank() method) the method will throw an IllegalArgumentException (with any message) and perform no processing.@param comments@return true if comments added; false otherwise*/ public boolean addComments(String comments) { }

/** Returns copy so changes to the copy does not affect the original. Your implementation must be efficient (avoid any unnecessary copies). @return ArrayList of strings */ public ArrayList getComments() { }

/** Videos will be compared using title. If we were to sort an ArrayList ofVi deos, they will appear in lexicographical (alphabetical) order (e.g, "A","B", "C").@return negative, 0, or positive value */ public int compareTo(Video video) { }

/** Two Video objects are considered equal if they have the same title. Implement the method using the instanceof operator rather than using getClass(). @return true if objects are considered equal; false otherwise */ @Override public boolean equals(Object obj) { } }

Student.test - to test the methods implemented in each java

public class StudentTests {

@Test public void test() { fail("Not yet implemented"); }

}

TubeManager.java is done already use this link to see it https://www.chegg.com/homework-help/questions-and-answers/tubevideosmanagerjava-public-class-tubevideosmanager-implements-tubevideosmanagerint-priva-q67349575?trackid=FI9_l8-L

SampleDriver.java

public static void main(String[] args) { String output = ""; output += "============== One ============== "; String title = "How to Draw in Java Tutorial"; String url = "https://www.youtube.com/embed/ifVf9ejuFWI"; int durationInMinutes = 17; Genre genre = Genre.Educational; Video video = new Video(title, url, durationInMinutes, genre); video.addComments("Nice video"); video.addComments("Recommended"); output += video; output += "Comments: " + video.getComments() + " "; output += "============== Two ============== "; /* Creating playlist and adding video */ Playlist playlist = new Playlist("Favorites") playlist.addToPlaylist(title); playlist.addToPlaylist(title); playlist.addToPlaylist("Hello"); output += playlist + " "; playlist.removeFromPlaylistAll(title); output += "After remove" + " "; output += playlist + " "; output += "============== Three ============== "; TubeVideosManager tubeVideosManager = new TubeVideosManager(); /* Adding first video */ tubeVideosManager.addVideoToDB(title, url, durationInMinutes, genre); /* Adding second video */ title = "Git & GitHub Crash Course for Beginners"; url = "https://www.youtube.com/embed/SWYqp7iY_Tc"; durationInMinutes = 33; genre = Genre.Educational; tubeVideosManager.addVideoToDB(title, url, durationInMinutes, genre); /* Getting videos */ ArrayList

ExpectedResults

Title: "How to Draw in Java Tutorial" Url: https://www.youtube.com/embed/ifVf9ejuFWI Duration (minutes): 17 Genre: Educational

[Nice video, Recommended]

[Title: "How to Draw in Java Tutorial" Url: https://www.youtube.com/embed/ifVf9ejuFWI Duration (minutes): 17 Genre: Educational , Title: "Git & GitHub Crash Course for Beginners" Url: https://www.youtube.com/embed/SWYqp7iY_Tc Duration (minutes): 33 Genre: Educational ]

Feel free to comment and i will thumbs up

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Eric Redmond ,Jim Wilson

1st Edition

1934356921, 978-1934356920

More Books

Students also viewed these Databases questions