Last active
May 29, 2019 07:25
-
-
Save ellehallal/d5a213541359a9ca7ee1362ece611705 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MusicPlayer implements MediaPlayer{ | |
private String songName; | |
private boolean isPlaying = false; | |
public MusicPlayer(String songName) { | |
this.songName = songName | |
} | |
@Override | |
public void play() { | |
isPlaying = true; | |
} | |
@Override | |
public void stop() { | |
isPlaying = false; | |
} | |
@Override | |
public void currentlyPlaying() { | |
if (isPlaying) { | |
System.out.println(songName + " is currently playing."); | |
} | |
else { | |
System.out.println("Nothing is playing."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment