Skip to main content

Practice · 2 of 3

The five-play like rule

CHALLENGE
Difficulty: advanced+25 XP

Implement Song: constructor takes the title (plays 0, not liked). play() increments the play count; on the **fifth** play the song becomes liked (plays 6, 7, … do nothing further). unlike() clears the liked flag (plays are NOT reset — and reaching five again after unlike does nothing). isLiked() reports the flag.

Back to lesson: Practice: Class design gauntlet