-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSong.java
More file actions
50 lines (39 loc) · 891 Bytes
/
Song.java
File metadata and controls
50 lines (39 loc) · 891 Bytes
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
40
41
42
43
44
45
46
47
48
49
50
public class Song {
private String title;
private String artist;
private int duration;
private User owner;
public Song() {
this("", "", 0, 0);
}
public Song(String t, String a, int m, int s) {
title = t;
artist = a;
duration = m * 60 + s;
owner = null;
}
public void setOwner(User owner) {
this.owner = owner;
}
public User getOwner() {
return owner;
}
public String getTitle() {
return title;
}
public String getArtist() {
return artist;
}
public int getDuration() {
return duration;
}
public int getMinutes() {
return duration / 60;
}
public int getSeconds() {
return duration % 60;
}
public String toString() {
return ("\"" + title + "\" by " + artist + " " + (duration / 60) + ":" + (duration % 60));
}
}