Repository navigation
Expand file tree
/
Copy pathSong.java
More file actions
112 lines (106 loc) · 2.07 KB
/
Copy pathSong.java
File metadata and controls
112 lines (106 loc) · 2.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// -== CS400 Spring 2024 File Header Information ==-
// Name:Saksham Dhuria
// Email: sdhuria@wisc.edu
// Lecturer: Gary Dahl
// Notes to Grader: boring class
public class Song implements SongInterface{
private String title;
private String artist;
private String genres;
private int year;
private int bpm;
private int energy;
private int danceability;
private int loudness;
private int liveness;
/*
main method for constructor
*/
public Song(String title, String artist, String genres, int year, int bpm, int energy, int danceability, int loudness, int liveness){
this.title=title;
this.artist=artist;
this.genres=genres;
this.year=year;
this.bpm=bpm;
this.energy=energy;
this.danceability=danceability;
this.loudness=loudness;
this.liveness=liveness;
}
/*
getter method for title
*/
@Override
public String getTitle(){
return title;
}
/*
getter method for artist
*/
@Override
public String getArtist(){
return artist;
}
/*
getter method for genre
*/
@Override
public String getGenres(){
return genres;
}
/*
getter method for year
*/
@Override
public int getYear(){
return year;
}
/*
getter method for bpm
*/
@Override
public int getBPM(){
return bpm;
}
/*
getter method for energy
*/
@Override
public int getEnergy(){
return energy;
}
/*
getter method for danceability
*/
@Override
public int getDanceability(){
return danceability;
}
/*
getter method for loudness
*/
@Override
public int getLoudness(){
return loudness;
}
/*
getter method for liveliness
*/
@Override
public int getLiveness(){
return liveness;
}
/*
compare to based on getBPM
*/
@Override
public int compareTo(SongInterface other){
if(this.getBPM()<other.getBPM()){
return -1;
}
if(this.getBPM()==other.getBPM()){
return 0;
}
return 1;
}
}