Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I created an array of ratings and movies from 30 people in my java program in cl

ID: 3815195 • Letter: I

Question

I created an array of ratings and movies from 30 people in my java program in class. Now my professor wants us to Create a method that determines a score for each of the 30 people, which represents how similar that person's tastes are to the current user's tastes. Store these similarity scores in an array of 30 doubles. The similarity scores should be between 0 and 1 each.

program should be in simple java language.

Calculating Similarity

Your program is going to try to decide whether or not you might like a movie that you haven't yet seen. It's going to come up with a score, which represents the likelihood that you'll enjoy it. If people who have tastes similar to yours seem to like it, the program will assign that movie a higher score. The question is,How do you determine similarity?

You can come up with your own way of judging how similar two people's ratings are. One suggestion is to compute what's called cosine similarity:  

for person 1, compute the square of each movie rating for movies they have seen, and add these up and then take the square root. Store the result in a variable called p1. For example, if person 1 saw 3 movies and rated them 4, 4, and 2, then p1 = sqrt(4*4 + 4*4 + 2*2) = sqrt(36) = 6.

do the same for person 2, and store the result in a variable called p2.

for each movie that both people have seen, compute the product of their ratings. Add up all of these products, and store the result in a variable called both. For example, if person 1 and person 2 both saw movies 7 and 14 (out of 20), and person 1 rated them as 4 for movie 7 and 2 for 14, and person 2 rated them as 2 for movie 7 and 3 for movie 14, then both = 4*2 + 2*3.

The cosine similarity score between person 1 and person 2 is (both / (p1 * p2)).

Explanation / Answer

import java.io.score ;
public class Movie implements Score {
public String title;
public String score;
public int year;
public int rating;
public Movie(String deTitle, String score, int hetYear, int deRating) {
title = deTitle;
director = score;
year = hetYear;
rating = deRating;
}
public void setTitle(String title) {
this.title = title;
}
public void setDirector(String score) {
this.director = director;

}
public void setYear(int year) {
this.year = year;
}
public void setRating(int rating) {
this.rating = rating;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote