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

The song informs the playlist when it has ended by calling the playingHasEnded()

ID: 3528354 • Letter: T

Question


The song informs the playlist when it has ended by calling the playingHasEnded() method. This method moves to the next song in the playlist, assuming the playlist contains additional songs what is the solutions

--------------------------------------------------------------------------------------------

public void play()

{ if (songs.size()>0) {

currentSongPlaying = 0;

state = "playing";

Mp3 song = songs.get(currentSongPlaying);

song.play(this);

}

} public void forward() {

if (state.equals("playing")) {

Mp3 song = songs.get(currentSongPlaying);

song.stop();

if (songs.size()-1>currentSongPlaying) {

currentSongPlaying = currentSongPlaying + 1;

song = songs.get(currentSongPlaying);

song.play(this);

} else if (songs.size()-1==currentSongPlaying) {

state="notPlaying";

}

}

} public void playingHasEnded() {

if ((songs.size()>currentSongPlaying) && (state.equals("playing"))) {

currentSongPlaying = currentSongPlaying + 1;

Mp3 song = songs.get(currentSongPlaying);

song.play(this);

} else if (state.equals("playing")) {

state = "notPlaying";

}

Explanation / Answer

public void play() { if (songs.size()>0) { currentSongPlaying = 0; state = "playing"; Mp3 song = songs.get(currentSongPlaying); song.play(this); } } public void forward() { if (state.equals("playing")) { Mp3 song = songs.get(currentSongPlaying); song.stop(); if (songs.size()-1>currentSongPlaying) { currentSongPlaying = currentSongPlaying + 1; song = songs.get(currentSongPlaying); song.play(this); } else if (songs.size()-1==currentSongPlaying) { state="notPlaying"; } } } public void playingHasEnded() { if ((songs.size()>currentSongPlaying) && (state.equals("playing"))) { currentSongPlaying = currentSongPlaying + 1; Mp3 song = songs.get(currentSongPlaying); song.play(this); } else if (state.equals("playing")) { state = "notPlaying"; } the code is correct what else do u want

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