-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSong.java
More file actions
37 lines (34 loc) · 1.07 KB
/
Song.java
File metadata and controls
37 lines (34 loc) · 1.07 KB
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
public class Song {
private String title;
private String author;
private int secondsDuration;
private int publishingYear;
/** Constructor needs the title, the author, and the duration in seconds.
* @param t : The title of the song
* @param au : The author of the song
* @param durat : The duration of the song, in seconds
*/
public Song(String t, String au, int durat, int pubYear){
this.title = t;
this.author = au;
this.secondsDuration = durat;
this.publishingYear = pubYear;
}
public String getAuthor() {
return author;
}
public String getTitle() {
return title;
}
public int getSecondsDuration() {
return secondsDuration;
}
public int getPublishingYear() {
return publishingYear;
}
/**Override the toString method in order to print song details.*/
@Override
public String toString(){
return this.title + " by " + this.author + " - " + (this.secondsDuration)/60 + "m" + ", published in: "+ this.publishingYear;
}
}