Question: JAVA. This is the second part of the program that I'm working on. I've already set up a constructor for the class but I'm struggling

JAVA. This is the second part of the program that I'm working on. I've already set up a constructor for the class but I'm struggling with using a BufferedReader to access a file that is given by an auto-grader.

JAVA. This is the second part of the program that I'm working

load(String filename): Read a file of info Strings with the given name. For each line of the file, create a Song and add it to the end of the Playlist. This method is intended to be a helper method for Playlist(String filename) and addSongs(String filename). save(String filename): Save the output of toString() to a file with the given name. (Overwrite the contents of the file if it already exists.) .addSong(Song song): Add a copy of the given Song to the end of the Playlist. .addSong(int index, Song song): Add a copy of the given Song to the Playlist at the given index. addSongs(String filename): A public version of the method Load(String filename). .getSong(int index): Return a copy of the Song with the given index. numSongs(): Return the number of Songs in the Playlist. playSong(int index): Increment the number of plays of the Song with the given index. remove Song(int index): Remove and return the song with the given index. (It is not necessary to return a copy.) toString(): Return a String with the values of the fields of every Song in the Playlist. Create the String by calling toString() on each Song and joining the output with newline characters. (Do not terminate the String with a newline character.) For example, if a Playlist contains Songs constructed with these info Strings: "So What, Miles Davis, 9:22" "Firth of Fifth, Genesis,9:35" Then calling toString() on the Playlist should return this String: "So What, Miles Davis, 9:22 Firth of Fifth, Genesis, 9:35" favorite Artist(): Return the artist that appears most frequently in the Playlist. If the Playlist is empty, return null. totalPlaytime(): Return the total length of all the songs in the following format: "::::::

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!