Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I already have the song class and the MP3_Player class. I only need the main cla

ID: 3533049 • Letter: I

Question

I already have the song class and the MP3_Player class. I only need the main class now!

Write a program that simulates an MP3 player.

Your program should begin by using the Song class already developed in the tutorials. Modify this class to include another attribute, fileSize, that determines how much bytes of storage space the song uses. Add an accessor getFileSize method and modify the constructor of the Song class to properly make use of this new attribute.

Next, you must define a new class, called MP3_Player, that manages a collection of Song objects. Since you don't know how many songs your player has, you should utilize the ArrayList to manage the songs. Additionally, your MP3_Player should have a storage capacity attribute which represents how much memory/storage the player holds. Your MP3_Player class must allow songs to be added, removed, and played. When a song is added, you should check to ensure that there is enough space remaining in the memory/storage of the MP3_Player; if the file size of the to-be-added song exceeds the remaining space of the player, the song should not be added. When a song is played, it should play the song completely by invoking the play() method of the song until it is completed. When a song is removed, it should be taken out of the MP3_Player ArrayList that holds the songs. The MP3_Player should be able to display the list of songs it holds and display how much memory capacity it has and how much memory remains (based upon the songs' file sizes consuming some memory). Your class must conform to the following API:

Once you have defined these classes, write a main program that instantiates an object of the MP3_Player class and makes use of it, adding songs and displaying information concerning the object.

Be sure to comment your program well.

A sample output of a possible solution:

Justice for All added to the MP3 player.
Wish you were here added to the MP3 player.
You Belong With Me added to the MP3 player.
Cannot add 'Sabotage'; not enough free space.
Cannot add 'Come As You Are'; not enough free space.

MP3 player with capacity of 15, 14 used, contains:
'Justice for All' by Metallica lasts for 11.75 and is 5mb large
'Wish you were here' by Pink Floyd lasts for 6.25 and is 6mb large
'You Belong With Me' by Taylor Swift lasts for 4.0 and is 3mb large

Justice for All is playing at position 0.1
Justice for All is playing at position 0.2
Justice for All is playing at position 0.3
Justice for All is playing at position 0.4
... [ REMOVED FOR BREVITY SAKE]
Justice for All is playing at position 11.600008
Justice for All is playing at position 11.700008
Justice for All has finished playing.
You Belong With Me removed from the MP3 player.
Come As You Are added to the MP3 player.

MP3 player with capacity of 15, 13 used, contains:
'Justice for All' by Metallica lasts for 11.75 and is 5mb large
'Wish you were here' by Pink Floyd lasts for 6.25 and is 6mb large
'Come As You Are' by Nirvana lasts for 3.75 and is 2mb large

Explanation / Answer

http://wikisend.com/download/268332/Java Code Combined.txt