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. Only Playlist.java and student test needs implementation the rest are done

Implement a video manager. You can add videos, create playlists, generate HTML for playlists. Only Playlist.java and student test needs implementation the rest are done already

  • tubeVideosManager A package where you will find shells for classes you need to implement.
  • tests A package where you will find public tests and a shell file for student tests.
  • text files/directories Files providing input for public tests, and support directories will be found in the main project folder. Expected outputs for public tests will be found in the expectedResults folder. Results generated by your code when you run your public tests will be placed in the results folder.

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) { } }

public class Video implements Comparable

public Video(String title, String url, int durationInMinutes, Genre videoGenre) { if (videoGenre == null || title == null || url == null || title.isBlank() || url.isBlank() || durationInMinutes <= 0) { throw new IllegalArgumentException("Invalid Parameters"); } this.title = title; this.url = url; this.durationInMinutes = durationInMinutes; this.videoGenre = videoGenre; this.comments = new ArrayList(); }

public Video(Video video) { this.title = video.title; this.url = video.url; this.durationInMinutes = video.durationInMinutes; this.videoGenre = video.videoGenre; this.comments = new ArrayList(); for (int i = 0; i < video.comments.size(); i++) { this.comments.add(video.comments.get(i)); } }

public String getTitle() { return title; }

public String getUrl() { return url; }

public int getDurationInMinutes() { return durationInMinutes; }

public Genre getGenre() { return videoGenre; }

public String toString() { String answer = "Title: " + "\"" + title + "\" "; answer += "Url: " + url + " "; answer += "Duration (minutes): " + durationInMinutes + " "; answer += "Genre: " + videoGenre + " " return answer;}

public boolean addComments(String comments) { if (comments == null || comments.isBlank()) { throw new IllegalArgumentException("Invalid parameters"); } this.comments.add(comments); return true; }

public ArrayList getComments() { ArrayList temp = new ArrayList(); for (int i = 0; i < comments.size(); i++) { temp.add(comments.get(i)); } return temp; }

public int compareTo(Video video) { return title.compareTo(video.title); }

public boolean equals(Object obj) { if (this == obj) { return true;} if (obj == null ) { return false;} if (obj instanceof Video) { Video vid = (Video) obj; return vid.toString().equals(this.toString()); } return false; } }

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

Comment if you are confused and thank you i will give a 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

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago