Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 songmovie if the extra ratings were added. Note that you are not
actually adding the ratings to the SongMovie You are only using the extra ratings in your computation of the
average
Example: If a song has ratings of and and this method is called with parameters and extra ratings of
value then the bayesian average is instead of the regular average of
If a songmovie has no ratings and this method is called with additional ratings, return
The method should work as expected in the edge cases of extra ratings eg Adding extra ratings of value
the output should be the normal average rating and a songmovie that has no ratings eg Adding any number
of extra ratings of value to a songmovie that has not been rated should return
If the input is invalid, this method will return The input is invalid if the value of the extra ratings is anything
other than or 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 This song would have a perfect average rating of and would be rated higher than
a song that has been rated times with an average rating of The second song is wellloved by many
people, and you would likely rather have that song in your playlist than the song that only 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 ratings of
being added, the first song would be lowered to an average of while the second song's rating would still be
This provides a more useful rating system than directly taking the average of all ratings.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started