Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint โ€” OOP

โญ beginnerโณ 20 min read๐Ÿ“ Lesson 41 of 85

A media library: a base `MediaItem`, audio and video specializations, and a contract-level player loop.

Checkpoint: the media library

Task: implement in Solution:

  1. Abstract class MediaItem โ€” protected Title, public constructor throwing ArgumentException for null/whitespace title, read-only Title, public abstract int PlaySeconds();.
  2. Song(string title, int seconds) โ€” returns seconds.
  3. Video(string title, int seconds, int speed) โ€” playback at speed (1 = normal); PlaySeconds() returns the wall-clock time: seconds / speed (integer division is fine).
  4. static int TotalRuntime(List<MediaItem> items) โ€” sum of PlaySeconds(); null/empty โ†’ 0.