-
Notifications
You must be signed in to change notification settings - Fork 1
/
Song.java
34 lines (28 loc) · 1.01 KB
/
Song.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
import java.io.Serializable;
public class Song implements Serializable {
private static final long serialVersionUID = 1L;
//Characteristics of a song
String name = "";
String artist= "";
String genre = "";
double songLength = 0;
int timesPlayed = 0;
String lyric = "";
//Constructor
public Song(String name, String artist,String genre, double songLength, String lyric){
this.name = name;
this.artist = artist;
this.genre = genre;
this.songLength = songLength;
this.lyric = lyric;
}
//Prints the song information
public void getSong(){
System.out.println("Song: " + name + "\n" + "Aritist: " + artist + "\n" + "Genre: " + genre + "\n" + "Song Length: " + songLength + "\n" + "Times Played: " + timesPlayed + "\n" + "Lyric: " + lyric);
}
//Plays the lyric of the current song
public void playSong() {
System.out.println("\""+ lyric + "\"\n");
timesPlayed++;
}
}