Question: Code this please Create a FileReader class in the ratings package the following static methods will be tested and implemented: A static method named readSongs
Code this please
Create a FileReader class in the ratings package the following static methods will be tested and implemented:
A static method named readSongs that takes a String as a parameter and returns and ArrayList of Songs
The input String is the name of a file to be read. This file will be a CSV file where each line matches the format
from the songs.csv file: "songID,artist,title,reviewerID,rating"
The method will return an ArrayList of Songs containing all of the information from the input file. If a song
appears in the file more than once, this means that it has been rated by multiple reviewers. In this case, only one
Song object should be returned for that song, and it should contain all the ratings for this song from the file
If the input file does not exist, the method will return an empty ArrayList
The Songs in the returned ArrayList may appear in any order. Your tests must accept any order of the
returned Songs This is much of the challenge in writing these tests
The ratings for each song must be added to the song in the order in which they appear in the file. When testing
the linked list of Ratings for a song, you can assume that they are in the same order in which they appear in
the file This will make it simpler to test the linked list
A static method named readMovies that takes a String as a parameter and returns an ArrayList of Movies
The input String is the name of a file to be read. This will be a CSV file where each line matches the format
from the movies.csv file that you can download above:
"movieTitle,castMembercastMembercastMemberetc" and there can be any number of cast members, but
there must be at least one cast member per movie
The method will return an ArrayList of Movies containing all of the information from the input file
If the input file does not exist, the method will return an empty ArrayList
The movies in the returned ArrayList may appear in any order. Your tests must accept any order of the
returned movies This is much of the challenge in writing these tests
The cast for each movie must be in the ArrayList in the same order in which they appear in the line for that
movie. You should assume this order when testing the cast ArrayLists The capitalization of the cast names
will be exactly as they appear in the file so there's no need to ignore case when comparing names
A static method named readMovieRatings that takes an ArrayList of Movies and a String as parameters.
The method returns an ArrayList of Movies
The input ArrayList of Movies will contain Movie objects with their title and cast populated. These movies
should not have any ratings added to them. When your program runs, it is intended for this ArrayList to be
provided by your readMovies method
The input String is the name of a file to be read. This will be a CSV file where each line matches the format
from the movieratings.csv file that you can download above: "title,reviewerld,rating"
The method will return an ArrayList of Movies containing the movies from the input ArrayList along with
their ratings read from the input file. If a Movie from the input ArrayList does not have any ratings in the
ratings file, it should not be included in the output ArrayList. If a movie has been rated that is not included in
the input ArrayList, the rating should be ignored eg If you find a rating for a movie that is in the input, do
not create a Movie object for the rating
Movies will have unique titles. Any movies with identical titles have been removed from the source data. Do not
write tests where the input ArrayList contains multiple movies with the same title. Any ratings for movies with
the same title should be treated as multiple ratings for the same movie
If the input file does not exist, the method will return an empty ArrayList
The Movies in the returned ArrayList may appear in any order. Your tests should accept any order of the
returned movies
The ratings for each Movie must be in the order in which they appear in the file. When testing the linked list of
Ratings for a Movie, you can assume that they are in the same order in which they appear in the file This will
make it simpler to test the linked list
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
