Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Find top favourite movies among friends 1.Implement theAnalyzerclass so that itssolvermethod returns an array of up to the top three movie titles that have been

1.Find top favourite movies among friends

1.Implement theAnalyzerclass so that itssolvermethod returns an array of up to thetop threemovie titles that have been set as the favourite ones by friends of a given user. You can assume that the function input structures are properly populated.

2.If thesolvermethod doesn't returntop threemovies, it should return the best N number of movies up to 3, otherwise, it should return an empty list.

3.Movies of the same count should be ordered alphabetically.

Data structures

EachMovieobject consists of:

  • title(std::string). Unique, for the purposes of this task treat it as index.
  • duration(std::string).
  • actors(std::vectorofstd::string).
  • watchlist(std::vectorofint) - list of User ID's for users who have this movie on the watchlist.
  • favorites(std::vectorofint) - list of User ID's for users who have this movie in the favorites list.
  • ratings(std::vectorofRating).

EachRatingobject consists of:

  • userId(int) - User ID of the corresponding user.
  • rating(int) - Integer rating (0-10) the user gave the Movie.

EachUserobject consists of:

  • userId(int)
  • email(std::string)
  • friends(std::vectorofint) - User ID's of this user's friends.

Example data

This is example data that is going to be loaded from JSON objects:

Movies collection:

{

"title": "The Shawshank Redemption",

"duration": "PT142M",

"actors": [ "Tim Robbins", "Morgan Freeman", "Bob Gunton" ],

"ratings": [],

"favorites": [66380, 7001, 9250, 34139],

"watchlist": [15291, 51417, 62289, 6146, 71389, 93707]

},

Example output

Your implementation should return the following output foruserId=62289:

["The Dark Knight", "The Godfather", "Pulp Fiction"]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

4 Explain how companies analyse and use marketing information

Answered: 1 week ago