IEB 2024: Easy Listening Songs

HardGrade 12

South African Records manages musicians and the songs they release while under contract. Each song has a like/dislike count. You need to model Musician and Song, group everything under a manager class, and find which musicians have been under contract 'long term' and which of their songs count as 'easy listening'. A song is well-liked if it has more likes than dislikes. An easy-listening song has more than 5000 likes AND is well-liked. Genres are encoded as 1=Rock, 2=Gqom, 3=Amapiano, 4=Techno (anything else is 'Uncategorised'). If a musician's stage name is blank, their stage name is just their full name. See the 📄 Exam Paper tab for the verbatim question. Platform note: the original paper computes 'years under contract' against today's date, which isn't reproducible for exact-output grading here — so a reference date is given as an explicit input instead.

Input / Output

Input: Line 1: a reference date, yyyy-MM-dd (used instead of "today" — see note above). Line 2: an integer N — number of musicians. Next N lines, ';'-separated: <name>;<stageName>;<genre 1-4>;<start date, yyyy MM dd> (stageName may be empty). Next line: an integer M — number of songs. Next M lines, ';'-separated: <artistName>;<title>;<likes>;<dislikes> Output, in order: "Musicians" then each musician as stageName<TAB>genreText<TAB>startDate, one per line (blank line) "Songs" then each song as title<TAB>likes<TAB>dislikes, one per line (blank line) "Long Term Musicians:" then, for every musician whose contract began more than 5 whole years before the reference date, "<name> <numYears> years." (skip anyone not long-term) (blank line) "Easy Listeners:" then, for each musician in input order: a line "<name> Easy Listeners", followed by each of their easy-listening song titles (one per line) — or "No suitable songs" if they have songs but none qualify, or "No songs recorded" if they have none at all. One blank line between musicians.

Examples

Input

2024-06-01
7
Jenny Sampson;Rebel;4;2023 03 13
Thabisile Ndlovu;;1;2022 09 26
Suse Mai;Flowers;1;2012 11 27
Samuel Ericson;;1;2019 10 19
Kabelo Mthembu;Easy K;2;2011 07 26
Kusuma Chapman;;3;2021 06 12
Roger Hatfield;;3;2024 02 01
10
Samuel Ericson;Running Energy;7355;6987
Kusuma Chapman;Highway Wilderness;3113;841
Jenny Sampson;Friday Cocktail;6127;4657
Kusuma Chapman;Lighter Lola;9238;7206
Samuel Ericson;No Chance;4986;4737
Jenny Sampson;Discover Light;7855;0
Kabelo Mthembu;Babona;9439;8118
Suse Mai;Change The Fusion;1018;601
Kabelo Mthembu;Walking With Gqom;8141;6187
Thabisile Ndlovu;First Heart;7979;11011

Expected Output

Musicians
Rebel	Techno	2023-03-13
Thabisile Ndlovu	Rock	2022-09-26
Flowers	Rock	2012-11-27
Samuel Ericson	Rock	2019-10-19
Easy K	Gqom	2011-07-26
Kusuma Chapman	Amapiano	2021-06-12
Roger Hatfield	Amapiano	2024-02-01

Songs
Running Energy	7355	6987
Highway Wilderness	3113	841
Friday Cocktail	6127	4657
Lighter Lola	9238	7206
No Chance	4986	4737
Discover Light	7855	0
Babona	9439	8118
Change The Fusion	1018	601
Walking With Gqom	8141	6187
First Heart	7979	11011

Long Term Musicians:
Suse Mai 11 years.
Kabelo Mthembu 12 years.

Easy Listeners:
Jenny Sampson Easy Listeners
Friday Cocktail
Discover Light

Thabisile Ndlovu Easy Listeners
No suitable songs

Suse Mai Easy Listeners
No suitable songs

Samuel Ericson Easy Listeners
Running Energy

Kabelo Mthembu Easy Listeners
Babona
Walking With Gqom

Kusuma Chapman Easy Listeners
Lighter Lola

Roger Hatfield Easy Listeners
No songs recorded

+ 1 hidden test checked on Submit.

Files

Main.java is the entry point. Add extra classes for OOP exercises — they compile together.

Song.java
Loading...

Run your code to see test results here.