Write a class Song (title, seconds, toString → Intro (1:05)) and a public class Playlist that keeps an ArrayList<Song>. Commands until the end of input:
add TITLE SECONDS— at the end;first TITLE SECONDS— at the front (add(0, …));remove TITLE— printsno song TITLEif it is absent;up TITLE— swaps the song with the one before it (usegetandset);show— numbered list, then3 songs, 9 min 40 s, longest: Finale.
Write a helper int find(ArrayList<Song> songs, String title).
For the input
add Intro 65 add Anthem 240 add Finale 275 show up Finale first Hello 30 remove Anthem remove Missing show
the program prints
1. Intro (1:05)
2. Anthem (4:00)
3. Finale (4:35)
3 songs, 9 min 40 s, longest: Finale
no song Missing
1. Hello (0:30)
2. Intro (1:05)
3. Finale (4:35)
3 songs, 6 min 10 s, longest: Finale