summaryrefslogtreecommitdiff
path: root/debugging/Media.java
diff options
context:
space:
mode:
authorpants <niklasjo2004@gmail.com>2026-09-21 14:16:34 -0700
committerpants <niklasjo2004@gmail.com>2026-09-21 14:16:34 -0700
commit81ba9eb66f8284d8760012973f84cdbe617ceb94 (patch)
tree466432644e9e3fd66ee183ec53a1f10abb1b7faa /debugging/Media.java
Diffstat (limited to 'debugging/Media.java')
-rw-r--r--debugging/Media.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/debugging/Media.java b/debugging/Media.java
new file mode 100644
index 0000000..ee9614e
--- /dev/null
+++ b/debugging/Media.java
@@ -0,0 +1,41 @@
+import java.util.*;
+
+/**
+ * An interface to represent various types of media (movies, books, tv shows, songs, etc.).
+ */
+public interface Media {
+ /**
+ * Gets the title of this media.
+ *
+ * @return The title of this media.
+ */
+ public String getTitle();
+
+ /**
+ * Gets all artists associated with this media.
+ *
+ * @return A list of artists for this media.
+ */
+ public List<String> getArtists();
+
+ /**
+ * Adds a rating to this media.
+ *
+ * @param score The score for the new rating. Should be non-negative.
+ */
+ public void addRating(int score);
+
+ /**
+ * Gets the number of times this media has been rated.
+ *
+ * @return The number of ratings for this media.
+ */
+ public int getNumRatings();
+
+ /**
+ * Gets the average (mean) of all ratings for this media.
+ *
+ * @return The average (mean) of all ratings for this media. If no ratings exist, returns 0.
+ */
+ public double getAverageRating();
+}