aleheux-tc
/
Java-Programming-and-Software-Engineering-Fundamentals-Java-Programming-Build-a-Recommendation-Syst
Public
forked from mxc19912008/Java-Programming-and-Software-Engineering-Fundamentals-Java-Programming-Build-a-Recommendation-Syst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMovieRunnerAverage.java
34 lines (32 loc) · 1.19 KB
/
MovieRunnerAverage.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Write a description of MovieRunnerAverage here.
*
* @author (your name)
* @version (a version number or a date)
*/
import java.util.*;
public class MovieRunnerAverage {
public void printAverageRatings(){
SecondRatings sr = new SecondRatings("ratedmoviesfull.csv","ratings.csv");
System.out.println("Movies number: "+sr.getMovieSize());
System.out.println("Raters number: "+sr.getRaterSize());
int minimalRaters = 12;
ArrayList<Rating> avgList = sr.getAverageRatings(minimalRaters);
Collections.sort(avgList);
for(Rating r: avgList){
System.out.println(r.getValue()+" "+sr.getTitle(r.getItem()));
}
}
public void getAverageRatingOneMovie(){
SecondRatings sr = new SecondRatings("ratedmoviesfull.csv","ratings.csv");
String title = "Vacation";
String movieId = sr.getID(title);
int minimalRaters = 0;
ArrayList<Rating> avgList = sr.getAverageRatings(minimalRaters);
for(Rating r: avgList){
if(r.getItem().equals(movieId)){
System.out.println(title+" "+r.getValue());
}
}
}
}