Write a Java class called Song to represent a song in a music collection. The data members of the Song class are String objects representing the song title, artist’s name and the album where the song can be found. These instance variables for the class are to have private access modifiers so you will need to write the appropriate methods to allow the client to access the data values. In accordance with good programming practice you are to override the equals and toString methods. In addition, this class is going to be used in a Collection that is to be sorted, so it is to implement the Comparable interface. A second class is to be written called SongList that contains a main method that reads in a file name via the command line. The file is a listing of the songs on one of my playlists. In the file each song is on a single line. The line is formatted with the song name, the artist name and the album separated by a colon (:) and varying amounts of white space. Each playlist contains 70 songs. The program is to prompt the user to enter the name of an artist and provide a formatted list of all the songs by that artist that appear on the playlist, grouped by album and in alphabetical order by song title. If no songs by the given artist are on the playlist, an appropriate message is to be displayed
Write a Java class called Song to represent a song in a music collection. The data members of the Song class are String objects representing the song title, artist’s name and the album where the song can be found. These instance variables for the class are to have private access modifiers so you will need to write the appropriate methods to allow the client to access the data values. In accordance with good programming practice you are to override the equals and toString methods. In addition, this class is going to be used in a Collection that is to be sorted, so it is to implement the Comparable interface.
A second class is to be written called SongList that contains a main method that reads in a file name via the command line. The file is a listing of the songs on one of my playlists. In the file each song is on a single line. The line is formatted with the song name, the artist name and the album separated by a colon (:) and varying amounts of white space. Each playlist contains 70 songs.
The program is to prompt the user to enter the name of an artist and provide a formatted list of all the songs by that artist that appear on the playlist, grouped by album and in alphabetical order by song title. If no songs by the given artist are on the playlist, an appropriate message is to be displayed.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images