Project: playlist manager | CSE2123 | Ohio State University

Overview

This project will allow you to write a program to get more practice with object-oriented ideas that we explored in the previous project, as well as some practice with more advanced ideas such as inheritance and the use of interfaces.

Ipods and other MP3 players organize a user’s music selection into groups known as playlists. These are data structures that provide a collection of songs and an ordering for how those songs will be played. For this assignment you will be writing a set of PlayList classes that could be used for a program that organizes music for a user. These classes will be written to implement a particular PlayList interface so that they can be easily exchange in and out as the program requires. In addition, you will also be using the SimpleTrack class you wrote for the closed lab on Interfaces – if you did not finish this class before the end of lab, you will need to finish it before starting on this project.

Objectives

  • Practice with programming fundamentals
    • Review of various Java fundamentals (branching, loops, variables, methods, etc.)
    • Review of Java File I/O concepts
    • Practice with Java ArrayList concepts
    • Practice with object-oriented programming and design
    • Practice with Java interfaces

Project Description

The SimplePlaylist Class

Once you have coded and tested your SimpleTrack class, you will need to write a SimplePlaylist class that implements the Playist interface given in the project folder.

The SimplePlayList class stores music tracks in order – the first track added to the play list should be the first one removed from the play list.  You should recognize this data structure as a queue (or a first-in, first-out queue).   You do not need to implement the equals, hashCode and toString methods for this class but if you choose to do so make sure you document your implementations properly!

 The PlayList Management Program

Once you have written and tested a SimpleTrack class and a SimplePlaylist class, it is time to use them to write a program to manage playlists.  This program will simulate the playing of songs from a play list.  For the SimplePlaylist, the songs are removed from the playlist as they are played, so you know that you’re at the end of the list when your list is empty.  This program should be implemented in the file MusicPlayerSimulator.java.  Note that we are not defining ANY of the methods you are using for this program – the design is all up to you.  You must, however, practice good programming style – make sure you are breaking the program up into smaller methods and aren’t just trying to solve everything with one monolithic main method.  If you have fewer than 5 methods for this program you are probably trying to fit too much into a single method.

Here is a sample transcript of the output of this program:

Enter database filename: input.txt Currently playing: 'Elvis Presley / Blue Suede Shoes / Elvis Presley: Legacy Edition' Next track to play: 'The Beatles / With A Little Help From My Friends / Sgt. Pepper's Lonely Hearts Club Band' [P]lay next track [A]dd a new track [Q]uit > p Currently playing: 'The Beatles / With A Little Help From My Friends / Sgt. Pepper's Lonely Hearts Club Band' Next track to play: 'The White Stripes / Seven Nation Army / Elephant' [P]lay next track [A]dd a new track [Q]uit > P Currently playing: 'The White Stripes / Seven Nation Army / Elephant' Next track to play: 'Cake / Long Line Of Cars / Comfort Eagle' [P]lay next track [A]dd a new track [Q]uit > a Track name: Requiem For A Dying Song Artist name: Flogging Molly Album name: Float Track: Requiem For A Dying Song Artist: Flogging Molly Album: Float Are you sure you want to add this track [y/n]? Currently playing: 'The White Stripes / Seven Nation Army / Elephant' Next track to play: 'Cake / Long Line Of Cars / Comfort Eagle' [P]lay next track [A]dd a new track [Q]uit > A Track name: Look What You Made Me Do Artist name: Taylor Swift Album name: Reputation Track: Look What You Made Me Do Artist: Taylor Swift Album: Reputation Are you sure you want to add this track [y/n]? Y Currently playing: 'The White Stripes / Seven Nation Army / Elephant' Next track to play: 'Cake / Long Line Of Cars / Comfort Eagle' [P]lay next track [A]dd a new track [Q]uit > q Tracks remaining in play list ------------------------------------------------------------ 1 - 'Cake / Long Line Of Cars / Comfort Eagle' 2 - 'Nine Inch Nails / Head Like A Hole / Pretty Hate Machine' 3 - 'Flogging Molly / Requiem For A Dying Song / Float' 4 - 'Taylor Swift / Look What You Made Me Do / Reputation'
  1. Ask the user to enter the name of the file that contains the play list data in the format described below.   
  2. Input the play list information from the file and store it in a SimplePlaylist object (using SimpleTrack objects).   See below for the format of this file.
  3. Indicate what song is currently playing and what song is next in the play list.  If there is no song currently playing (i.e. at the beginning right after the data file is loaded) the program should immediately advance to the next song in the list.  If the play list is empty and there is no next track, the program should indicate this with a message “Play list is empty – no more tracks”.
  4. Present the user a menu of three options – play the next song in the play list, add a new song to the play list, or quit.
  5. If the user chooses to play the next song, use the Playlist object to adjust the current track accordingly.  Make sure your code does the right thing and gives an error message if the play list is empty and the user tries to play the next song.
  6. If the user chooses to add a new track, prompt the user for the names of the song, artist and album.  Verify that the user actually wants to add the track and if they say “yes” to this prompt add the track to the play list appropriately.
  7. If the user chooses to quit, output a well-formatted report of the remaining songs in the play list, showing the name of the song, the artist and the album in the format indicated above.  If the play list is empty, indicate this with the message “No tracks remaining” where the report data would normally be.  When this report is finished the Playlist should be empty.

The file format that the play list manager program should read is a simple one.  An input file for multiple tracks would use this format:

track 1 name,artist 1 name,album 1 name
...
track n name,artist n name,album n name

The sample input file used in the transcript above looks like this and is included in the project folder in a file named input.txt:

Blue Suede Shoes,Elvis Presley,Elvis Presley: Legacy Edition
With A Little Help From My Friends,The Beatles,Sgt. Pepper's Lonely Hearts Club Band
Seven Nation Army,The White Stripes,Elephant
Long Line Of Cars,Cake,Comfort Eagle
Head Like A Hole,Nine Inch Nails,Pretty Hate Machine

Submission Instructions

Make sure your programs compile and run correctly before submitting.  To submit, make sure you include all of your files:  SimplePlaylist.java, SimpleTrack.java and MusicPlayerSimulator.java files with comments indicating who wrote them and the date (make sure you change the @author tag to your name and the @version tag to the date).  If you worked with a partner, there should be two @author tags.  Use the file upload button and navigate to the folder your workspace is in.  Then look for the CSE2123-Playlist folder – inside that folder is the src folder that has your files in it to upload.  You can also just drag-and-drop the files from your Eclipse workspace directly onto the file upload button.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>