Skip to main content

Practice · 3 of 3

The library that drives its songs

CHALLENGE
Difficulty: advanced+25 XP

Implement Song (as before: five-play like rule with isLiked()) and Library: starts empty, add(Song) appends, playAll() plays every held song once, likedCount() returns how many held songs are currently liked. The Library must NOT duplicate play counts — it asks its songs.

Back to lesson: Practice: Class design gauntlet