-
Notifications
You must be signed in to change notification settings - Fork 1
/
Playlist.java
39 lines (32 loc) · 880 Bytes
/
Playlist.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.LinkedList;
public class Playlist{
LinkedList<Song> playlist = new LinkedList<Song>();
String playlistName;
int playlistTime;
Playlist(String name)
{
setName( name );
playlistTime = 0;
}
//Returns playlist
public LinkedList<Song> getPlaylist() {
return this.playlist;
}
//Returns playlist name
public String getName() {
return this.playlistName;
}
//Sets Username of user
public void setName(String username) {
this.playlistName = username;
}
//Adds new song to playlist
public void addToPlaylist(Song song){
playlist.add(song);
playlistTime = playlistTime + song.getLength();
}
public void removeFromPlaylist (Song song){
playlist.remove(song);
playlistTime = playlistTime - song.getLength();
}
}