public class MediaItem implements Lasting { /** * The duration of the item. */ private int duration; /** * The title of the item. */ private String title; /** * The views of the item. */ private int views; /** * Creates a media library item. * * @param title The title of the item. * @param duration The duration of the item. * @param views The views of the item. */ public MediaItem(int duration, String title, int views) { this.duration = duration; this.title = title; this.views = views; } /** * Returns the title of the item. * * @return The title of the item. */ public String getTitle() { return title; } /** * Returns the views of the item. * * @return The views of the item. */ public int getViews() { return views; } /** * Returns the duration of the item. * * @return The duration of the item. */ public int getDuration() { return duration; } /** * Returns a string representation of the media item. * * @return A string representation of the media item. */ public String toString() { return title + " (" + views + " " + duration + " min)"; } }