-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSong.java
More file actions
50 lines (40 loc) · 881 Bytes
/
Song.java
File metadata and controls
50 lines (40 loc) · 881 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
package chapter16;
class Song implements Comparable<Song> {
String title;
String artist;
String rating;
String bpm;
public boolean equals(Object aSong){
Song s = (Song) aSong;
return getTitle().equals(s.getTitle());
}
public int hashCode() {
return title.hashCode();
}
Song (String t, String a, String r, String b) {
title = t;
artist = a;
rating = r;
bpm = b;
}
public String getTitle() {
return title;
}
public String getArtist() {
return artist;
}
public String getRating() {
return rating;
}
public String getBpm() {
return bpm;
}
@Override
public String toString() {
return title;
}
@Override
public int compareTo(Song s) {
return title.compareTo(s.getTitle());
}
}