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

Task need Main: Write a program that simulates an MP3 player. Your program shoul

ID: 3642160 • Letter: T

Question

Task need Main:
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:

Explanation / Answer

public class Song { private String title; private String artist; private float duration; private float currentPlayPosition; private boolean IsPlaying; private float fileSize; public Song() { title = "no title"; artist = "no artist"; duration = 0.0f; currentPlayPosition = 0.0f; IsPlaying = false; fileSize = 0.0f; System.out.println("Constructor is finished"); } public Song(String t, String a, float d, float e) { title = t; artist = a; duration = d; fileSize = e; currentPlayPosition = 0.0f; IsPlaying = false; System.out.println("Constructor with parameters is finished"); } public String toString() { return "'" + title + "' by " + artist + " lasts for " + duration +" and is " +fileSize + "Mb large."; } public String getTitle() { return title; } public String getArtist() { return artist; } public float getDuration() { return duration; } public boolean getIsPlaying() { return IsPlaying; } public float getfileSize() { return fileSize; } public void setTitle(String newTitle) { if (newTitle.compareTo("") != 0) title = newTitle; } public void setArtist(String newArtist) { if (newArtist.compareTo("") != 0) artist = newArtist; } public void setDuration(float newDuration) { if(newDuration>=0) duration = newDuration; } public void setfileSize(float newSize) { if(newSize>=0) fileSize = newSize; } public void Play() { IsPlaying = true; currentPlayPosition += 0.1f; if(currentPlayPosition
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote