In: Computer Science
reate a class Song with the data members listed below:
Include the following member functions:
You only need to write the class definition and any code that is
required for that class (i.e., header and implementation).
NOTE: you must not use the implicit "private" for class data types
and methods. Include public or private explicitly.
class Song {
private String title;
private String artist;
private int downloads;
public Song() {
title = "";
artist = "";
downloads = 0;
}
public Song(String title, String artist, int
downloads) {
this.title = title;
this.artist = artist;
this.downloads = downloads;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getArtist() {
return artist;
}
public void setArtist(String artist) {
this.artist = artist;
}
public int getDownloads() {
return downloads;
}
public void setDownloads(int downloads) {
this.downloads = downloads;
}
public double grossRevenue(double price) {
return price * downloads;
}
}