Question: Java problem: This is part of a project. Dont worry about making a package with the class, I just don't know how to go about
Java problem: This is part of a project. Dont worry about making a package with the class, I just don't know how to go about writing the class itself. Create a new class in the ratings package named "DataSources" that will contains methods that read data into our program. In this class write a public static method named "readSongCSVFile" that takes one String as a parameter and returns an ArrayList of Songs. The input parameter is the name of a csv file containing song ratings where each line is in the format "YouTubeID,artist,title,rating" This method will return all the data in this file in an ArrayList of Songs. Note that songs can be rated multiple times in the file and each rating must be recorded in the same Song object that represents that song. (Hint: The YouTubeIDs are unique and can be used to identify a song and can stored in a data structure to check if you've seen a song multiple times. For each line that is read from the file, check if the YouTubeID from the line is already in your data structure. If it is, the rating needs to be added to the existing Song instead of creating a new Song object. One way to do this is by using a HashMap of YouTubeIDs (Strings) to Song objects)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
