To be able to use and manipulate linked lists, and gain experience with
menu-driven programs.
Task
You are to write a program for managing a playlist of songs. A playlist is
simply a list of songs — for this assignment it will be implemented as a
doubly linked list. Each song contains two pieces of information: the title
and the artist who performs it; each will be stored as strings.
Your program must support the following features:
Add a song to the playlist.
Remove a song from the playlist.
Print the number of songs in the playlist.
"Play" the playlist. For our purposes, this will mean just printing out
the songs from first to last.
Shuffle the list. You can do this any way you want so long as the list
changes each time, and doesn't change the exact same way. The shuffling should
not be easily predictable. You can't use Java's ArrayList class or Collections.shuffle()
method in your implementation.
Reverse the order of the playlist.
Save the playlist to a text file.
Load a previously saved playlist from a text file.
Start by downloading a copy of the DoubleList class we used in class: DoubleList.java. You should use this
as the basis for your linked list, but will need to add to it.
You will need to create a Song class for storing song objects. It will
need to store the artist and title, and contain whatever methods are needed
to support that.
You will need to create a linked list of Song objects for the playlist.
You can either fill in Song for the type parameter, or simply edit the
DoubleList class so it always contains Song objects.
Your third class should contain the main method, and will create the
playlist object and provide a menu for the user to operate on the playlist.
You can use any format for the commands you want, but should print out a
message at the start of the program describing how to use it.
In order to implement the "count" feature, you will have to add a method
to the doubly linked list class that counts the nodes in the list.
In order to implement the "reverse" feature, you will need to add a method
that reverses the order of the songs stored inside of the list. Note that
this is different than just printing it in reverse order. It should physically
change the list to be reversed.
In order to implement the "shuffle" feature, you will have to add a method
that rearranges the nodes in the list pseudo-randomly. In Java, you can create
a java.util.Random object, and then call the nextInt method on that object in
order to obtain random integers. Remember that you can call the other methods
(such as addStart, addEnd, and remove) inside of any other method in a
class.
You can use any formatting for saving and restoring the playlist to/from
a file. Just make sure that you can load back what you've saved!
Just For Fun
If you want to export your playlists so you can listen to them, you can use the following website:
https://www.tunemymusic.com/. Click "Let's Start", then
choose "Upload file" for the source and upload one of the saved playlist files from this program.
You can then choose a destination for exporting it including Spotify, Apple Music and YouTube.
General Requirements
All member data of a class must be private.
Your source code should be readable and reasonably indented.
You must provide comments in your code.
Your class should not cause Exceptions to be thrown in any situation.
Submitting
When you are done, submit your code for this program on Canvas.