Question: In Java please bayesianAverageRating - in the ratings. Ratable, add a method named bayesianAverageRating that takes 2 ints and returns a double: The first parameter

In Java please
bayesianAverageRating - in the ratings. Ratable, add a method named bayesianAverageRating that takes 2 ints
and returns a double:
The first parameter is a number of extra ratings
The second parameter is the value of the extra ratings
The method returns the average rating of the song/movie if the extra ratings were added. Note that you are not
actually adding the ratings to the Song/Movie. You are only using the extra ratings in your computation of the
average
Example: If a song has ratings of 4 and 5 and this method is called with parameters 2 and 3(2 extra ratings of
value 3), then the bayesian average is 4+5+3+34==3.75 instead of the regular average of 4.5
If a song/movie has no ratings and this method is called with 0 additional ratings, return 0.0
The method should work as expected in the edge cases of 0 extra ratings (eg. Adding 0 extra ratings of value 3-
the output should be the normal average rating), and a song/movie that has no ratings (eg. Adding any number
of extra ratings of value x to a song/movie that has not been rated should return x)
If the input is invalid, this method will return 0.0. The input is invalid if the value of the extra ratings is anything
other than 1,2,3,4, or 5 OR the number of extra ratings is negative
This method will be inherited by both Song and Movie, though you should test this method through the Song
and Movie classes. It is acceptable, and expected, that you copy your tests and use the same exact test cases for
both Song and Movie when testing this method.
Why? When comparing songs (Or anything), it's common to have many songs that are only rated by a single
reviewer who gave it a 55. This song would have a perfect average rating of 5.0 and would be rated higher than
a song that has been rated 100 times with an average rating of 4.99. The second song is well-loved by many
people, and you would [likely] rather have that song in your playlist than the song that only 1 person likes and
no one else is aware of. We adjust this by adding a few fake ratings to each song. In the example of 2 ratings of 3
being added, the first song would be lowered to an average of 3.67 while the second song's rating would still be
4.99. This provides a more useful rating system than directly taking the average of all ratings.
 In Java please bayesianAverageRating - in the ratings. Ratable, add a

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!