Question: 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

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, artists 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 a client class to access and modify the data values. In accordance with good programming practice, you are to override the equals and toString methods inherited from Object. In addition, this class is going to be used in a future project collection that is to be sorted, so youll need to implement the Comparable interface.

A second class is to be written called SongReader that contains a main method that reads in a file name via the command line. The file is a listing of the songs that have been formatted using angle-bracketed tags. For example,

</p> <p> The Trapeze Swinger</p> <p>

Iron and Wine

The Trapeze Swinger - Single

Each line is either a tag (opening or closing) or data. Tags are matched pairs of single words surrounded in angle brackets. Opening tags begin with an angle bracket (<) and closing tags begin with an angle bracket and forward slash (playlist.data, the first five song items are valid but the last one is invalid and should be rejected by the SongReader program.

The SongReader class will open and read the input file to create Song objects by parsing the file data. You are required to use an implementation of the given StackInterface interface in your project for matching opening and closing tags. You may not use any external parsing libraries. After reading the input, the SongReader class will display a list of the Song objects.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!