-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMovieRunnerAverage.java
More file actions
41 lines (33 loc) · 1.18 KB
/
MovieRunnerAverage.java
File metadata and controls
41 lines (33 loc) · 1.18 KB
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
35
36
37
38
39
40
41
import java.util.*;
/**
* Write a description of MovieRunnerAverage here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MovieRunnerAverage {
public void printAverageRatings()
{
SecondRatings sr = new SecondRatings
("ratedmovies_short.csv", "ratings_short.csv");
System.out.println("number of movies: "+sr.getMovieSize());
System.out.println("number of raters: "+sr.getRaterSize());
ArrayList<Rating> ratings = sr.getAverageRatings(3);
Collections.sort(ratings);
for(Rating r : ratings)
{
System.out.println(r.getValue()+" "+r.getItem());
}
}
public void getAverageRatingOneMovie()
{
SecondRatings sr = new SecondRatings
("ratedmovies_short.csv", "ratings_short.csv");
//Scanner sc = new Scanner(System.in);
//String movie = sc.nextLine();
String movie = "The Godfather";
String movieID = sr.getID(movie);
double avgRating = sr.getAverageByID(movieID, 0);
System.out.println("the average for the movie "+movie+" would be "+avgRating);
}
}