32 | * When users first visit the recommender website, our code will call the
33 | * method getItemsToRate()
to get a list of movies to display
34 | * on the web page for users to rate.
35 | *
36 | * When a user submits their ratings, our code will call the method
37 | * printRecommendationsFor
to get your recommendations based on the
38 | * user's ratings. The ID given to this method is for a new Rater that we
39 | * have already added to the RaterDatabase with ratings for the movies
40 | * returned by the first method. Whatever is printed from that method will
41 | * be displayed on the web page: HTML, plain text, or debugging information.
42 | */
43 | public interface Recommender {
44 | /**
45 | * This method returns a list of movie IDs that will be used to look up
46 | * the movies in the MovieDatabase and present them to users to rate.
47 | *
48 | * The movies returned in the list will be displayed on a web page, so 49 | * the number you choose may affect how long the page takes to load and 50 | * how willing users are to rate the movies. For example, 10-20 should 51 | * be fine, 50 or more would be too many. 52 | *
53 | * There are no restrictions on the method you use to generate this list 54 | * of movies: the most recent movies, movies from a specific genre, 55 | * randomly chosen movies, or simply your favorite movies. 56 | *
57 | * The ratings for these movies will make the profile for a new Rater
58 | * that will be used to compare to for finding recommendations.
59 | */
60 | public ArrayList
66 | * The HTML printed will be displayed on a web page, so the number you
67 | * choose to display may affect how long the page takes to load. For
68 | * example, you may want to limit the number printed to only the top
69 | * 20-50 movies recommended or to movies not rater by the given rater.
70 | *
71 | * You may also include CSS styling for your table using the <style>
72 | * tag before you print the table. There are no restrictions on which
73 | * movies you print, what order you print them in, or what information
74 | * you include about each movie.
75 | *
76 | * @param webRaterID the ID of a new Rater that has been already added to
77 | * the RaterDatabase with ratings for the movies returned by the
78 | * method getItemsToRate
79 | */
80 | public void printRecommendationsFor(String webRaterID);
81 | }
82 |
--------------------------------------------------------------------------------
/StepFive-Final/SecondRatings.java:
--------------------------------------------------------------------------------
1 | import java.util.ArrayList;
2 |
3 | /***************************************************************
4 | * Name: Wei Xu
5 | *
6 | * Date: Dec 11th, 2019
7 | *
8 | * Description: -------------------STEP TWO-------------------------
9 | * You will build on this assignment by calculating
10 | * average ratings of movies.
11 | * In this assignment you will modify a new class named SecondRatings,
12 | * which has been started for you, to do many of the calculations
13 | * focusing on computing averages on movie ratings.
14 | * You will also create a second new class named MovieRunnerAverage,
15 | * which you will use to test the methods you created in SecondRatings
16 | * by creating a SecondRatings object in MovieRunnerAverage and
17 | * calling its methods.
18 | *
19 | ****************************************************************/
20 | public class SecondRatings {
21 |
22 | private ArrayList